Skip to content

Commit 9ced7bc

Browse files
committed
fixup! feat(material-date-fns-adapter): add date adapter for date-fns
1 parent a1c2bfc commit 9ced7bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/material-date-fns-adapter/adapter/date-fns-adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function range<T>(length: number, valueFunction: (index: number) => T): T[] {
3535
return valuesArray;
3636
}
3737

38+
// date-fns doesn't have a way to read/print month names or days of the week directly,
39+
// so we get them by formatting a date with a format that produces the desired month/day.
3840
const MONTH_FORMATS = {
3941
long: 'LLLL',
4042
short: 'LLL',
@@ -175,8 +177,6 @@ export class DateFnsAdapter extends DateAdapter<Date, Locale> {
175177
return new Date(value);
176178
} else if (value instanceof Date) {
177179
return this.clone(value);
178-
} else if (value != null && value !== '') {
179-
return new Date(Date.parse(value));
180180
}
181181

182182
return null;

0 commit comments

Comments
 (0)