简体   繁体   中英

Is it possible for Tabulator to force time to 24Hours?

My server data is ready with 24 hour format. Example: There is a time value 00:00:00 stored in sql (server), when it comes to display data into tabulator it shows 12:00:00.

{title: "Time", field: "time",sorter:"number", editor:"input",formatter:"datetime", 
formatterParams:{inputFormat:"hh:mm:ss", outputFormat:"hh:mm:ss", invalidPlaceholder:"Invalid Time"}

Is there any attribute to force formatterParams into 24Hours?

What a custom formatter should look like?

Thanks in advance!

The built-in datetime formatter in Tabulator uses the moment.js library. Therefore you can use the format tokens from the moment.js docs to adjust the inputFormat and outputFormat for your needs.

To change the 12-hour default to 24-hour clock, simply replace "hh:mm:ss" with "HH:mm:ss".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM