openchs-models 1.30.18 → 1.30.19
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.
|
@@ -186,10 +186,14 @@ class DashboardFilterConfig {
|
|
|
186
186
|
validate(filterValue) {
|
|
187
187
|
const inputDataType = this.getInputDataType();
|
|
188
188
|
|
|
189
|
-
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime
|
|
189
|
+
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime].includes(inputDataType) && this.widget === _CustomFilter.default.widget.Range) {
|
|
190
190
|
return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
if (_Concept.default.dataType.Time === inputDataType && this.widget === _CustomFilter.default.widget.Range) {
|
|
194
|
+
return _DateTimeUtil.default.validateTimeRange(filterValue.minValue, filterValue.maxValue);
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
return [true];
|
|
194
198
|
}
|
|
195
199
|
|
|
@@ -19,6 +19,13 @@ class DateTimeUtil {
|
|
|
19
19
|
return [true];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
static validateTimeRange(fromTime, toTime) {
|
|
23
|
+
if (_lodash.default.isNil(toTime) && _lodash.default.isNil(fromTime)) return [true];
|
|
24
|
+
if (_lodash.default.isNil(toTime) || _lodash.default.isNil(fromTime)) return [false, 'bothTimeShouldBeSelectedError'];
|
|
25
|
+
if (!(0, _moment.default)(fromTime, 'HH:mm').isSameOrBefore((0, _moment.default)(toTime, 'HH:mm'))) return [false, 'startTimeGreaterThanEndError'];
|
|
26
|
+
return [true];
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
var _default = DateTimeUtil;
|