Topic: Setting Locale or custom format for date picker

teddynyambe priority asked 9 months ago


Expected behavior to output date in this form "yyyy-MM-dd HH:mm:ss" Actual behavior currently putputting the date in the follwoing format: "2022-02-22T21:00:00.000Z" Resources (screenshots, code snippets etc.)

I have attempted to do a hack by patching values of the formGroup but looks like Javescript interpreter in the browser doesnt like what am doing:

This code produced the error below in the browser:

journalEntryFormGroup = new FormGroup({
entryType: new FormControl(),
account: new FormControl(),
transaction: new FormGroup({
  transactionDate: new FormControl(),
  amount: new FormControl(),
  paymentType: new FormControl(),
  description: new FormControl()
})

});

transaction: {
    transactionDate: formatDate(this.journalEntryFormGroup.value['transaction']['transactionDate'] as Date, 'yyyy-MM-dd hh:mm:ssZZZZZ', 'en_US')
  }

core.js:6498 ERROR TypeError: date.getDay is not a function
at getDayNumber (mdb-angular-ui-kit-datepicker.js:308:1)
at MdbDatepickerComponent._updateHeaderDate (mdb-angular-ui-kit-datepicker.js:605:1)
at MdbDatepickerComponent._applyInputDate (mdb-angular-ui-kit-datepicker.js:858:1)
at SafeSubscriber._next (mdb-angular-ui-kit-datepicker.js:596:1)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:183:1)
at SafeSubscriber.next (Subscriber.js:122:1)
at Subscriber._next (Subscriber.js:72:1)
at Subscriber.next (Subscriber.js:49:1)
at Subject.next (Subject.js:39:1)
at mdb-angular-ui-kit-datepicker.js:1118:1

Arkadiusz Idzikowski staff commented 9 months ago

@teddynyambe Could you provide more information about the full HTML/TS code that you use and reproduction steps?



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • User: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 1.6.1
  • Device: Mackbook
  • Browser: Safari
  • OS: MacOS 12.2.1
  • Provided sample code: No
  • Provided link: No