@acpaas-ui/ngx-forms 6.1.6 → 6.1.7
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/lib/datepicker/components/datepicker/datepicker.component.mjs +20 -11
- package/fesm2015/acpaas-ui-ngx-forms.mjs +19 -10
- package/fesm2015/acpaas-ui-ngx-forms.mjs.map +1 -1
- package/fesm2020/acpaas-ui-ngx-forms.mjs +19 -10
- package/fesm2020/acpaas-ui-ngx-forms.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ import { get, isEqual, debounce } from 'lodash-es';
|
|
|
12
12
|
import { Subject, Observable } from 'rxjs';
|
|
13
13
|
import { takeUntil } from 'rxjs/operators';
|
|
14
14
|
import { DateHelper, IntervalBuilder } from '@acpaas-ui/ngx-utils';
|
|
15
|
+
import { TZDate } from '@date-fns/tz';
|
|
15
16
|
import * as i1$2 from '@acpaas-ui/ngx-calendar';
|
|
16
17
|
import { CALENDAR_DEFAULT_MONTH_LABELS, CALENDAR_DEFAULT_WEEKDAY_LABELS, CALENDAR_MONTH_LABELS, CALENDAR_WEEKDAY_LABELS, CalendarModule } from '@acpaas-ui/ngx-calendar';
|
|
17
18
|
import * as i4$1 from '@acpaas-ui/ngx-icon';
|
|
@@ -483,13 +484,13 @@ class DatepickerComponent {
|
|
|
483
484
|
const date = DateHelper.parseDate(format, 'yyyy-MM-dd');
|
|
484
485
|
if (date) {
|
|
485
486
|
this.selectedDate = date;
|
|
486
|
-
const
|
|
487
|
-
const
|
|
488
|
-
const
|
|
487
|
+
const brusselsDate = new TZDate(date, 'Europe/Brussels');
|
|
488
|
+
const year = brusselsDate.getFullYear();
|
|
489
|
+
const month = brusselsDate.getMonth();
|
|
490
|
+
const day = brusselsDate.getDate();
|
|
489
491
|
this.onChange(DateHelper.toUtcMidnightInBrussels(year, month, day));
|
|
490
492
|
}
|
|
491
493
|
else {
|
|
492
|
-
// Change value with original value (and not null or '') so we can add an error in the validate function
|
|
493
494
|
this.onChange(value);
|
|
494
495
|
}
|
|
495
496
|
}
|
|
@@ -518,12 +519,20 @@ class DatepickerComponent {
|
|
|
518
519
|
.build();
|
|
519
520
|
}
|
|
520
521
|
writeValue(value) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
522
|
+
if (typeof value === 'string') {
|
|
523
|
+
if (this.isISODateFormat(value)) {
|
|
524
|
+
this.selectedDate = DateHelper.parseDate(value);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.selectedDate = DateHelper.parseDate(value, 'dd/MM/yyyy');
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
else if (value instanceof Date) {
|
|
531
|
+
this.selectedDate = value;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this.selectedDate = null;
|
|
535
|
+
}
|
|
527
536
|
const dateString = this.selectedDate ? this.formatDate(this.selectedDate) : '';
|
|
528
537
|
this.formControl.setValue(dateString);
|
|
529
538
|
}
|