Topic: Format date in Datatable dataset
GrantPhillips priority asked 3 years ago
We have data that is returned from an API and it contains numerous date fields. When the dates are displayed in the MDBDatatable, they are output in the following format:Tue Oct 05 2021 09:42:13 GMT+1300 (New Zealand Daylight Time)
We would like to display the dates with a format of "dd-MM-yyyy".
We would like to use the Column 'format' attribute to be able to change the display value
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Resolved
Specification of the issue
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Vue
- MDB Version: MDB5 1.4.0
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No
Mikołaj Smoleński staff commented 3 years ago
I recommend to use e.g. dayjs package for parsing date objects and make inside the fetch method (or axios if you use this library). It's described here: https://mdbootstrap.com/docs/b5/vue/data/datatables/#section-async-data.
An example of data managing is here:
Keep coding, Mikołaj from MDB