Customize Date Formats
Contents
Overview
This article introduces how to customize date formats in Kintone Apps using Luxon. With this library, date formats in Kintone can be displayed in other formats, such as "5 days ago" and "tomorrow".
Prepare the App
Create the Form
Create an App with the following field settings.
Field Type | Field Name | Field Code |
---|---|---|
Text | Ticket name | ticketname |
Updated datetime | Last updated | lastupdate |
Set the Library
This sample uses Luxon v2.3.0. Set the following URL into the App's JavaScript and CSS Customization settings .
- https://js.kintone.com/luxon/2.3.0/luxon.min.js
Sample Code
Type the following code into a text editor and save it as a JavaScript file. Upload it to the App's JavaScript and CSS Customization settings .
|
|
Attention
Caution: The order in which JavaScript and CSS are uploaded to an app matters. In this example, ensure that the Luxon library is uploaded before the sample JavaScript file. The order of the uploads can be changed by clicking and dragging on the arrows for each item on the Upload JavaScript / CSS page.
After saving the settings and updating the App, navigate to the Record List page. The Updated datetime field should display the date in a new format, such as "X hours ago" and "X days ago".