'Tabulator 5.0 - parsing datetime luxon - datetime ISO 8601
I currently try to parse datetime in tabulator js library. My datetime string is "2021-09-11T00:00:00.000Z".
On the last release, they change the datetime library to luxon. I didn't success to find the good format for that kind of date. In the documentation, it seems that they kept the last datetime library moment.js. I read the luxon documentation but i didn't succeed.
I tried :
{title:"Début Campagne", field:"start_date" ,formatter:"datetime", formatterParams:{ inputFormat:"yyyy-MM-ddTHH:mm:ss:SSSZ", outputFormat:"dd/MM/yyyy"}}
The way tabulator use luxon, i can't use the function Datetime.FromIso than can parse ISO 8601 so i have to found the correct format.
Thank you for your help
Solution 1:[1]
As of Tabulator v5.1 there is now built in iso support for formatters
{title:"Example", field:"example", formatter:"datetime", formatterParams:{
inputFormat:"iso",
}}
And sorters:
{title:"Example", field:"example", sorter:"datetime", sorterParams:{
format:"iso",
}}
Solution 2:[2]
As you see datetime , there you can see that you will not able to use ISO date here.. In your case you are using ISO data format which needs to be format using fromISO and then you can format it.
It might help you codesandbox
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Oli Folkerd |
| Solution 2 | Double H |
