This patch makes the egDateInput directive fetch the
date format from the format.date library setting. The
directive also now accepts a dateFormat attribute for cases
where there is a reason to override the library setting.
If no format is set via library setting or in how the
directive is invoked, the format defaults to "mediumDate",
e.g., "May 2, 1999".
To test:
[1] Open the webstaff patron registration form. Verify that
date widgets display the date in the format that
corresponds to the value of the format.date library setting
for the current work station, or (if the library setting
is not set, "Month day, year".
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
<input type="text"
class="form-control"
ng-show="!hideDatePicker"
- uib-datepicker-popup="shortDate"
+ uib-datepicker-popup="{{date_format}}"
is-open="datePickerIsOpen"
ng-model="ngModel"
ng-change="ngChange"
* Handy wrapper directive for uib-datapicker-popup
*/
.directive(
- 'egDateInput', ['egStrings',
- function(egStrings) {
+ 'egDateInput', ['egStrings', 'egCore',
+ function(egStrings, egCore) {
return {
scope : {
closeText : '@',
ngBlur : '=',
ngDisabled : '=',
ngRequired : '=',
- hideDatePicker : '='
+ hideDatePicker : '=',
+ dateFormat : '=?'
},
require: 'ngModel',
templateUrl: './share/t_datetime',
if ('showTimePicker' in attrs)
scope.showTimePicker = true;
+
+ var default_format = 'mediumDate';
+ egCore.org.settings(['format.date']).then(function(set) {
+ default_format = set['format.date'];
+ scope.date_format = (scope.dateFormat) ?
+ scope.dateFormat :
+ default_format;
+ });
}
};
}