@aaamb/ngx-design-system 1.1.0 → 1.1.1
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.
|
@@ -946,9 +946,11 @@ class InputDatepickerComponent {
|
|
|
946
946
|
return Number.isNaN(value.getTime()) ? null : value;
|
|
947
947
|
}
|
|
948
948
|
if (typeof value === 'string') {
|
|
949
|
-
const parsed = this.parseDate(value);
|
|
949
|
+
const parsed = this.parseDate(this.normalizeToUsDateFormat(value));
|
|
950
950
|
if (parsed)
|
|
951
951
|
return parsed;
|
|
952
|
+
if (!this.isIsoDateString(value))
|
|
953
|
+
return null;
|
|
952
954
|
const isoDate = new Date(value);
|
|
953
955
|
return Number.isNaN(isoDate.getTime()) ? null : isoDate;
|
|
954
956
|
}
|
|
@@ -967,6 +969,9 @@ class InputDatepickerComponent {
|
|
|
967
969
|
}
|
|
968
970
|
return null;
|
|
969
971
|
}
|
|
972
|
+
isIsoDateString(value) {
|
|
973
|
+
return /^\d{4}-\d{2}-\d{2}(?:[T\s].*)?$/.test(value.trim());
|
|
974
|
+
}
|
|
970
975
|
formatDate(date) {
|
|
971
976
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
972
977
|
const day = String(date.getDate()).padStart(2, '0');
|