adb-shared 3.0.9 → 3.0.10
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/components/date-picker/adb-date-picker.directive.mjs +6 -6
- package/fesm2015/adb-shared.mjs +5 -5
- package/fesm2015/adb-shared.mjs.map +1 -1
- package/fesm2020/adb-shared.mjs +5 -5
- package/fesm2020/adb-shared.mjs.map +1 -1
- package/lib/components/date-picker/adb-date-picker.directive.d.ts +1 -1
- package/package.json +1 -1
package/fesm2020/adb-shared.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import * as i1 from '@angular/common/http';
|
|
|
9
9
|
import { HttpClientModule } from '@angular/common/http';
|
|
10
10
|
import * as i1$2 from '@angular/router';
|
|
11
11
|
import { RouterModule } from '@angular/router';
|
|
12
|
-
import { startOfDay, subYears, endOfDay, addYears, getMonth, subMonths, addMonths, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isSameDay, isSameMonth, isWithinInterval, isValid, parseISO } from 'date-fns';
|
|
12
|
+
import { startOfDay, subYears, endOfDay, addYears, getMonth, subMonths, addMonths, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isSameDay, isSameMonth, isWithinInterval, isValid, parseISO, parse } from 'date-fns';
|
|
13
13
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
14
14
|
import { delay } from 'rxjs/operators';
|
|
15
15
|
|
|
@@ -770,7 +770,7 @@ class AdbDatePickerDirective {
|
|
|
770
770
|
return null;
|
|
771
771
|
}
|
|
772
772
|
if (typeof value === 'string' || value instanceof String) {
|
|
773
|
-
const date = AdbDatePickerDirective.tryParse(value);
|
|
773
|
+
const date = AdbDatePickerDirective.tryParse(value, this.format);
|
|
774
774
|
if (!date) {
|
|
775
775
|
return { date: true };
|
|
776
776
|
}
|
|
@@ -783,7 +783,7 @@ class AdbDatePickerDirective {
|
|
|
783
783
|
writeValue(value) {
|
|
784
784
|
if (value) {
|
|
785
785
|
if (typeof value === 'string' || value instanceof String) {
|
|
786
|
-
const date = AdbDatePickerDirective.tryParse(value);
|
|
786
|
+
const date = AdbDatePickerDirective.tryParse(value, this.format);
|
|
787
787
|
if (!date) {
|
|
788
788
|
this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
|
|
789
789
|
return;
|
|
@@ -808,8 +808,8 @@ class AdbDatePickerDirective {
|
|
|
808
808
|
setDisabledState(isDisabled) {
|
|
809
809
|
this.viewContainerRef.clear();
|
|
810
810
|
}
|
|
811
|
-
static tryParse(dateString) {
|
|
812
|
-
const parsed =
|
|
811
|
+
static tryParse(dateString, format) {
|
|
812
|
+
const parsed = parse(dateString, format, new Date());
|
|
813
813
|
return isValid(parsed) ? parsed : null;
|
|
814
814
|
}
|
|
815
815
|
getId() {
|