Date/time handling: Intl apis?
Date/time handling: Intl apis?
RichardD2
Posts: 27Questions: 2Answers: 1
Looking at Date and Time handling, you have support for both Moment.js and Luxon. But both Intl.DateTimeFormat and Intl.RelativeTimeFormat are "widely available", since 2017 and 2020 respectively.
Would it be worth adding support for those APIs to DataTables? Or is it simpler to just call them directly from the application code?
Replies
Hi,
DataTables'
date()rendering method does already use theIntldate time formatter. There is an example available here. I've added a new example to the date / time section of examples as well, as this actually caught me out yesterday (thinking "I'm sure I had an example of this, where is it..."!).It is worth noting that it is output rendering only. If you want to parse a formatted string, you still need to use Luxon or Moment.
Allan