Skip to content

Commit 05a1b06

Browse files
committed
fix(flatpickr-adapter): handle missing formatter property
Restores compatibility when private component is used directly.
1 parent 39fcb13 commit 05a1b06

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/date-picker/flatpickr-adapter/flatpickr-adapter.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ export class DatePickerCalendar {
136136
break;
137137
}
138138

139-
this.picker.formatter = this.formatter;
139+
if (this.formatter) {
140+
this.picker.formatter = this.formatter;
141+
}
140142
}
141143

142144
public componentDidUpdate() {

src/components/date-picker/pickers/Picker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { isAndroidDevice, isIOSDevice } from '../../../util/device';
1414
const ARIA_DATE_FORMAT = 'F j, Y';
1515

1616
export abstract class Picker {
17-
public formatter: (date: Date) => string;
17+
public formatter = (date: Date) =>
18+
moment(date).locale(this.getMomentLang()).format(this.dateFormat);
1819

1920
protected dateFormat: string;
2021
protected language: string = 'en';

0 commit comments

Comments
 (0)