mdb-date-picker fails to handle any start [ngModel] value ex


Topic: mdb-date-picker fails to handle any start [ngModel] value except empty string

Arsenii pro asked 2 years ago

Here is html: <mdb-date-picker name="date-picker" [options]="datePickerOptions" [placeholder]="'Date'" [(ngModel)]="date"></mdb-date-picker> Here is typescript: datePickerOptions = {   dateFormat: 'd mmm yyyy' }; date = ""; If date is empty, date picker works correctly and after selecting or reselecting date displays and saves it in correct text format (eg "17 Mar 2018"). But if date is not empty before first date picker opening and still has date in set format (or ISO string), date picker displays "-1 undefined -1" instead of date and can't work properly during date reselecting.

Arsenii pro answered 2 years ago

Date picker can correctly select and change dates in format "d mmm yyyy" (eg "7 Mar 2018) but fails with such input. To have possibility input dates you need to choose "dd mmm yyyy" (eg "07 Mar 2018) format.

Damian Gemza staff commented 2 years ago

Dear Arsenii, Unfortunately, for now, there's no possibility to put those dateFormat as initial date. We're working on improving this. Best Regards, Damian

Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No