I'm using ng-pick-datetime UI component for the date picker. I disabled readonly
mode, so that the input is active for typing with keyboard.
<owl-date-time name="client_birthday" #client_birthday="ngModel"
[placeHolder]="'DD.MM.YYYY'"
[locale]="ru"
[(ngModel)]="client.client_birthday"
[type]="'calendar'"
[dataType]="'string'"
[dateFormat]="'DD.MM.YYYY'"
[readonlyInput] ="false"
[autoClose] ="true"
[inputId]="'client_birthday'"
></owl-date-time>
I try to apply RU
locale using date-fns
:
ru: any;
ruLocale = require('date-fns/locale/ru');
ngOnInit() {
this.ru = {
firstDayOfWeek: 1,
dayNames: [...],
dayNamesShort: [...],
monthNames: [...],
monthNamesShort: [...],
dateFns: this.ruLocale
};
}
When I type into the input with dd.mm.yyyy
format, the picker makes day as a month and month as a day, and the year is ok. So, the only format it recognizes is mm.dd.yyyy
, which seems to be us
locale. My calendar language changed as expected, but is it possible to configure date format for RU
as well?
I would appreciate any help.