@servicemind.tis/tis-smart-table-viewer 2.4.14 → 2.4.16
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.
|
@@ -163,7 +163,17 @@ const getFromLocalStorageWithExpiry = (key) => {
|
|
|
163
163
|
if (!itemStr) {
|
|
164
164
|
return null;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
// Guard against corrupt / non-JSON values (e.g. written by an older version
|
|
167
|
+
// or other code). Treat an unparseable entry as missing and self-heal by
|
|
168
|
+
// removing it, instead of throwing and breaking the caller (ngOnChanges).
|
|
169
|
+
let item;
|
|
170
|
+
try {
|
|
171
|
+
item = JSON.parse(itemStr);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
localStorage.removeItem(key);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
167
177
|
const now = new Date();
|
|
168
178
|
if (!item.expiry) {
|
|
169
179
|
localStorage.removeItem(key);
|
|
@@ -1780,21 +1790,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
1780
1790
|
class TisDatePipe {
|
|
1781
1791
|
transform(value, format) {
|
|
1782
1792
|
const fmt = format || 'dd MMM yyyy';
|
|
1783
|
-
|
|
1784
|
-
|
|
1793
|
+
// Empty / "no date" inputs render blank (0 and "0" are treated as no-date).
|
|
1794
|
+
if (value === null || value === undefined || value === '' || value === 0 || value === '0') {
|
|
1795
|
+
return '';
|
|
1785
1796
|
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1797
|
+
let dt;
|
|
1798
|
+
if (value instanceof Date) {
|
|
1799
|
+
dt = DateTime.fromJSDate(value);
|
|
1788
1800
|
}
|
|
1789
|
-
else if (value
|
|
1790
|
-
|
|
1801
|
+
else if (typeof value === 'number') {
|
|
1802
|
+
dt = DateTime.fromMillis(value);
|
|
1791
1803
|
}
|
|
1792
|
-
else if (
|
|
1793
|
-
|
|
1804
|
+
else if (typeof value === 'string') {
|
|
1805
|
+
const num = Number(value);
|
|
1806
|
+
// Numeric string => epoch millis (unchanged); non-numeric => ISO date.
|
|
1807
|
+
dt = !isNaN(num) ? DateTime.fromMillis(num) : DateTime.fromISO(value);
|
|
1794
1808
|
}
|
|
1795
1809
|
else {
|
|
1796
|
-
return '
|
|
1810
|
+
return '';
|
|
1797
1811
|
}
|
|
1812
|
+
// Invalid inputs render blank instead of the literal "Invalid Date".
|
|
1813
|
+
return dt.isValid ? dt.toFormat(fmt) : '';
|
|
1798
1814
|
}
|
|
1799
1815
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TisDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1800
1816
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: TisDatePipe, isStandalone: false, name: "tisDate" });
|
|
@@ -1810,18 +1826,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
1810
1826
|
class TisDateTimePipe {
|
|
1811
1827
|
transform(value, format) {
|
|
1812
1828
|
const fmt = format || 'dd MMM yyyy hh:mm a';
|
|
1813
|
-
|
|
1814
|
-
|
|
1829
|
+
// Empty / "no date" inputs render blank (0 and "0" are treated as no-date).
|
|
1830
|
+
if (value === null || value === undefined || value === '' || value === 0 || value === '0') {
|
|
1831
|
+
return '';
|
|
1815
1832
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1833
|
+
let dt;
|
|
1834
|
+
if (value instanceof Date) {
|
|
1835
|
+
dt = DateTime.fromJSDate(value);
|
|
1818
1836
|
}
|
|
1819
|
-
else if (
|
|
1820
|
-
|
|
1837
|
+
else if (typeof value === 'number') {
|
|
1838
|
+
dt = DateTime.fromMillis(value);
|
|
1839
|
+
}
|
|
1840
|
+
else if (typeof value === 'string') {
|
|
1841
|
+
const num = Number(value);
|
|
1842
|
+
// Numeric string => epoch millis (unchanged); non-numeric => ISO date.
|
|
1843
|
+
dt = !isNaN(num) ? DateTime.fromMillis(num) : DateTime.fromISO(value);
|
|
1821
1844
|
}
|
|
1822
1845
|
else {
|
|
1823
|
-
return '
|
|
1846
|
+
return '';
|
|
1824
1847
|
}
|
|
1848
|
+
// Invalid inputs render blank instead of the literal "Invalid Date".
|
|
1849
|
+
return dt.isValid ? dt.toFormat(fmt) : '';
|
|
1825
1850
|
}
|
|
1826
1851
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TisDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1827
1852
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: TisDateTimePipe, isStandalone: false, name: "tisDateTime" });
|
|
@@ -1837,18 +1862,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
1837
1862
|
class TisDateTimeWithSecondsPipe {
|
|
1838
1863
|
transform(value, format) {
|
|
1839
1864
|
const fmt = format || 'dd MMM yyyy hh:mm:ss a';
|
|
1840
|
-
|
|
1841
|
-
|
|
1865
|
+
// Empty / "no date" inputs render blank (0 and "0" are treated as no-date).
|
|
1866
|
+
if (value === null || value === undefined || value === '' || value === 0 || value === '0') {
|
|
1867
|
+
return '';
|
|
1842
1868
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1869
|
+
let dt;
|
|
1870
|
+
if (value instanceof Date) {
|
|
1871
|
+
dt = DateTime.fromJSDate(value);
|
|
1845
1872
|
}
|
|
1846
|
-
else if (
|
|
1847
|
-
|
|
1873
|
+
else if (typeof value === 'number') {
|
|
1874
|
+
dt = DateTime.fromMillis(value);
|
|
1875
|
+
}
|
|
1876
|
+
else if (typeof value === 'string') {
|
|
1877
|
+
const num = Number(value);
|
|
1878
|
+
// Numeric string => epoch millis (unchanged); non-numeric => ISO date.
|
|
1879
|
+
dt = !isNaN(num) ? DateTime.fromMillis(num) : DateTime.fromISO(value);
|
|
1848
1880
|
}
|
|
1849
1881
|
else {
|
|
1850
|
-
return '
|
|
1882
|
+
return '';
|
|
1851
1883
|
}
|
|
1884
|
+
// Invalid inputs render blank instead of the literal "Invalid Date".
|
|
1885
|
+
return dt.isValid ? dt.toFormat(fmt) : '';
|
|
1852
1886
|
}
|
|
1853
1887
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TisDateTimeWithSecondsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1854
1888
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: TisDateTimeWithSecondsPipe, isStandalone: false, name: "tisDateTimeWithSeconds" });
|