See related

Format dates in shortcuts

Last Update: Oct 2024 • Est. Read Time: 2 MIN
To check plan availability, see the pricing page.

When responding to a customer with a shortcut that includes a date, you may want to adjust the formatting of the date. For example, a customer may be writing in about their reservation date. By default, using a date in a shortcut includes the timestamp, such as January 18, 2019 12:00 AM. You have the option to adjust the formatting of the date, pass in a locale, and set the timezone.

Who can access this feature?
User typesAdmins can adjust shortcuts.


   

The following are examples of how the date formatting can be used:

dateFormat (default)

{{dateFormat customer.custom.reservationDateAt}} will display the following date as: January 18, 2019.

dateFormat (with format option)

The formatting options are based on the Moment.js localized date formats here. The structure of the shortcut helper using the "ll" Moment.js date format would look like: {{dateFormat customer.custom.reservationDateAt format="ll"}} and will display the date as: Jan 18, 2019.

dateFormat (with locale option)

Another optional field to pass in when using this helper is the locale. By default, the locale is "en-us", but if you are based in the UK, you can pass in a date format of "en-gb". For example, {{dateFormat customer.custom.reservationDateAt locale="en-gb"}}  will display the date as: 18 January 2019.

dateFormat (with timezone option)

Formatting the date with a timezone ensures that the shortcut will output one standard timezone regardless of where agents are located. The timezone options are based on Moment.js (see a few examples here. The structure of the shortcut helper using the "America/Los_Angeles" timezone would look like: {{dateFormat customer.custom.reservationDateAt format="LL z" timezone="America/Los_Angeles"}} and will display the date as: January 17, 2019 PST.

Keep in mind that you can pass in any combination of the "format", "locale" and "timezone" options to adjust how the date will be displayed.