pjc-fields 0.0.51 → 0.0.52
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/fesm2022/pjc-fields.mjs
CHANGED
|
@@ -1239,7 +1239,23 @@ class PjcDataFieldComponent {
|
|
|
1239
1239
|
input.setSelectionRange(newCursor, newCursor);
|
|
1240
1240
|
};
|
|
1241
1241
|
writeValue(val) {
|
|
1242
|
-
|
|
1242
|
+
if (val === null || val === undefined) {
|
|
1243
|
+
this.value = null;
|
|
1244
|
+
}
|
|
1245
|
+
else if (typeof val === 'string') {
|
|
1246
|
+
// Parse ISO date strings (e.g., '1996-01-21') as local dates
|
|
1247
|
+
// to avoid timezone offset causing a day shift.
|
|
1248
|
+
// new Date('1996-01-21') parses as UTC midnight, which shifts
|
|
1249
|
+
// to the previous day in negative-UTC timezones.
|
|
1250
|
+
const parts = val.split('-').map(Number);
|
|
1251
|
+
this.value = parts.length >= 3
|
|
1252
|
+
? new Date(parts[0], parts[1] - 1, parts[2])
|
|
1253
|
+
: new Date(val);
|
|
1254
|
+
}
|
|
1255
|
+
else {
|
|
1256
|
+
this.value = val;
|
|
1257
|
+
}
|
|
1258
|
+
this.valueSignal.set(this.value);
|
|
1243
1259
|
this.cdr.markForCheck();
|
|
1244
1260
|
}
|
|
1245
1261
|
registerOnChange(fn) {
|
|
@@ -1386,7 +1402,19 @@ class PjcDataHoraFieldComponent {
|
|
|
1386
1402
|
input.setSelectionRange(newCursor, newCursor);
|
|
1387
1403
|
};
|
|
1388
1404
|
writeValue(val) {
|
|
1389
|
-
|
|
1405
|
+
if (val === null || val === undefined) {
|
|
1406
|
+
this.value = null;
|
|
1407
|
+
}
|
|
1408
|
+
else if (typeof val === 'string') {
|
|
1409
|
+
// Parse ISO date strings as local dates to avoid timezone offset day shift.
|
|
1410
|
+
const parts = val.split('-').map(Number);
|
|
1411
|
+
this.value = parts.length >= 3
|
|
1412
|
+
? new Date(parts[0], parts[1] - 1, parts[2])
|
|
1413
|
+
: new Date(val);
|
|
1414
|
+
}
|
|
1415
|
+
else {
|
|
1416
|
+
this.value = val;
|
|
1417
|
+
}
|
|
1390
1418
|
this.cdr.markForCheck();
|
|
1391
1419
|
}
|
|
1392
1420
|
registerOnChange(fn) {
|