MDB DatePicker Format Options error


Topic: MDB DatePicker Format Options error

pzimmer pro premium priority asked 3 years ago

Expected behavior Date should show in dd/mm/yyyy format

Actual behavior Shows in 0-1/0-1/-1 format when using public datePickerOptions: IMyOptions = { dateFormat: 'mm/dd/yyyy', };

Resources (screenshots, code snippets etc.) enter image description here

enter image description here


Arkadiusz Idzikowski staff commented 3 years ago

@pzimmer Please provide more information about datePickerOptions object and model.startDate value.


pzimmer pro premium priority commented 3 years ago

datePickerOptions is as follows: public datePickerOptions: IMyOptions = { dateFormat: 'mm/dd/yyyy', };

model.startDate is coming as data from MS SQL. It is in format of "2021-08-11T00:00:00-05:00"


Grzegorz Bujański staff answered 3 years ago

Try use new Date ()

startDate = '2021-08-11T00:00:00-05:00'

model = {
  startDate: new Date(this.startDate)
}

That should solve your problem.


FREE CONSULTATION

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

Status

Closed

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB4 11.1.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags