@leanix/components 0.4.760 → 0.4.761
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.
|
@@ -1897,6 +1897,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
1897
1897
|
}]
|
|
1898
1898
|
}] });
|
|
1899
1899
|
|
|
1900
|
+
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
1901
|
+
function createLocalDate(dateString) {
|
|
1902
|
+
const [year, month, day] = dateString.split('-').map(Number);
|
|
1903
|
+
return new Date(year, month - 1, day);
|
|
1904
|
+
}
|
|
1900
1905
|
class CustomDatePipe {
|
|
1901
1906
|
constructor(getDateFnLocale) {
|
|
1902
1907
|
this.getDateFnLocale = getDateFnLocale;
|
|
@@ -1905,7 +1910,17 @@ class CustomDatePipe {
|
|
|
1905
1910
|
if (!value) {
|
|
1906
1911
|
return '';
|
|
1907
1912
|
}
|
|
1908
|
-
|
|
1913
|
+
let date;
|
|
1914
|
+
if (value instanceof Date) {
|
|
1915
|
+
date = value;
|
|
1916
|
+
}
|
|
1917
|
+
else if (typeof value === 'string' && DATE_ONLY_PATTERN.test(value)) {
|
|
1918
|
+
// Handle date-only strings with local timezone to avoid UTC offset issues
|
|
1919
|
+
date = createLocalDate(value);
|
|
1920
|
+
}
|
|
1921
|
+
else {
|
|
1922
|
+
date = new Date(value);
|
|
1923
|
+
}
|
|
1909
1924
|
if (!isValid(date)) {
|
|
1910
1925
|
return '';
|
|
1911
1926
|
}
|