Datepicker selected date as date instead of string


Topic: Datepicker selected date as date instead of string
Hi, We just purchased MDB Pro and are starting to use the Datepicker. It seems as though the selected date that is bound to the model on selection change is a formatted string, and the format is dependent on the assigned format. With our locale and format (Finnish), this produces a problem, as the formatted string is not valid for Date.parse(). Furthermore, our application needs to have the locale changeable per user, so nothing regarding the format can be fixed. In general, wouldn't it be better to use a proper date object when emitting the change to the model? When we save the date back to a datastore, it has to be a date anyways, so I don't see the point of returning the formatted string.

Damian Gemza staff commented 7 years ago

Dear Tuuka, Thanks for your report! For now We can't provide you any ready-to-use solution that's fix this problem, but We'll think about improving this situation in future. Best Regards, Damian

p.malandra pro commented 7 years ago

Hi, I am facing the same problem. As I need this fix urgently, I would like to do this temporary change to DatePicker.component until you release an official fix: [row:632:now] this.dateChange.emit(dateModel) [row:632:changed] this.dateChanged.emit({ date: date, jsdate: null, formatted: dateModel, epoc: 0 }); Can I do it? Best Regards.

Damian Gemza staff commented 7 years ago

Dear p.malandra, It's not recommended by us to modify source files of our library because, with next project update, your changes will be overwritten by those from our repository. But if you really need this. feel free to edit it. Best Regards, Damian

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

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