@sumaris-net/ngx-components 2.6.3 → 2.6.4-rc2
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/esm2020/src/app/shared/dates.mjs +5 -6
- package/esm2020/src/app/shared/validator/validators.mjs +4 -4
- package/fesm2015/sumaris-net.ngx-components.mjs +5 -6
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +5 -6
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2748,14 +2748,13 @@ function fromDateISOString(value) {
|
|
|
2748
2748
|
// Already a moment object: use it
|
|
2749
2749
|
if (!value || isMoment(value))
|
|
2750
2750
|
return value;
|
|
2751
|
-
if (typeof value === 'string' && value.
|
|
2751
|
+
if (typeof value === 'string' && !!value.match(/^\d+[-/]\d+[-/]\d+$/g)) {
|
|
2752
2752
|
// Parse the input value, as a date only
|
|
2753
|
-
const dateOnly = DateUtils.moment(value, DATE_PATTERN);
|
|
2754
|
-
|
|
2755
|
-
return DateUtils.markNoTime(dateOnly);
|
|
2753
|
+
const dateOnly = DateUtils.moment(value, DATE_PATTERN, true);
|
|
2754
|
+
return DateUtils.markNoTime(dateOnly);
|
|
2756
2755
|
}
|
|
2757
2756
|
// Parse the input value, as a ISO date time
|
|
2758
|
-
const date = DateUtils.moment(value, DATE_ISO_PATTERN);
|
|
2757
|
+
const date = DateUtils.moment(value, DATE_ISO_PATTERN, true);
|
|
2759
2758
|
if (date.isValid())
|
|
2760
2759
|
return date;
|
|
2761
2760
|
// Not valid: trying to convert from unix timestamp
|
|
@@ -3647,7 +3646,7 @@ class SharedValidators {
|
|
|
3647
3646
|
}
|
|
3648
3647
|
static validDate(control) {
|
|
3649
3648
|
const value = control.value;
|
|
3650
|
-
const date = !value || isMoment(value) ? value :
|
|
3649
|
+
const date = !value || isMoment(value) ? value : fromDateISOString(value);
|
|
3651
3650
|
if (date && (!date.isValid() || date.year() < 1900)) {
|
|
3652
3651
|
return { validDate: true };
|
|
3653
3652
|
}
|