fng-bootstrap-date 0.12.0-beta.204 → 0.12.0-beta.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fng-bootstrap-date.js +15 -5
- package/package.json +1 -1
package/fng-bootstrap-date.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
$scope.popup.opened = true;
|
|
13
13
|
}
|
|
14
14
|
}])
|
|
15
|
-
.directive('fngUiBootstrapDatePicker', ['$compile', '$timeout', 'pluginHelper', 'formMarkupHelper', 'cssFrameworkService',
|
|
16
|
-
function ($compile, $timeout, pluginHelper, formMarkupHelper) {
|
|
15
|
+
.directive('fngUiBootstrapDatePicker', ['$compile', '$timeout', 'pluginHelper', 'formMarkupHelper', 'recordHandler', 'cssFrameworkService',
|
|
16
|
+
function ($compile, $timeout, pluginHelper, formMarkupHelper, recordHandler) {
|
|
17
17
|
return {
|
|
18
18
|
restrict: 'E',
|
|
19
19
|
replace: true,
|
|
@@ -51,7 +51,16 @@
|
|
|
51
51
|
scope.dateOptions = Object.assign(overriddenDateDefaults, jsonDateOptions);
|
|
52
52
|
["minDate","maxDate"].forEach(v => {
|
|
53
53
|
if (scope.dateOptions[v] && typeof scope.dateOptions[v] === "string") {
|
|
54
|
-
|
|
54
|
+
// allow minDate and maxDate to be derived from another (assumed to be date-typed) field, but with
|
|
55
|
+
// the limitation that the value of that field must be available now and must not change
|
|
56
|
+
// (i.e., this is effectively a one-time binding)
|
|
57
|
+
// one possible use case would be to use the value of a hidden "when created" field as a minimum
|
|
58
|
+
// or maximum value for another (not hidden) date field
|
|
59
|
+
if (scope.dateOptions[v].startsWith("record.") || scope.dateOptions[v].startsWith("subDoc.")) {
|
|
60
|
+
scope.dateOptions[v] = recordHandler.getData(scope, scope.dateOptions[v]);
|
|
61
|
+
} else {
|
|
62
|
+
scope.dateOptions[v] = new Date(scope.dateOptions[v]);
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
65
|
})
|
|
57
66
|
|
|
@@ -122,8 +131,9 @@
|
|
|
122
131
|
maxDate = new Date(scope.dateOptions.maxDate).valueOf();
|
|
123
132
|
}
|
|
124
133
|
if (minDate || maxDate) {
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
let dateFormat = attrs.format || attrs.dateFormat;
|
|
135
|
+
if (dateFormat !== 'dd/MM/yyyy') {
|
|
136
|
+
throw new Error('Unsupported date format in validdate: ' + dateFormat)
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
|
package/package.json
CHANGED