Displaying dates and time using JS
Last updated
Was this helpful?
Last updated
Was this helpful?
PDFMonkey’s engine runs on AWS servers located in Europe. The timezone of the server might not be the one you want your dates to be displayed in.
On the Liquid side you can use the filter to set a timezone and the filter to format a date. On the JavaScript side, you can use the toLocaleString
method.
The method returns a string with a language sensitive representation of a date.
The locales
and options
arguments let applications specify the language whose formatting conventions should be used and customize the behavior of the function.
Paid account only
Using an external JS library will only work on a paid account. On a free account preview and generation will be blocked.
You can learn more about the toLocaleString method in its .
If you need the help of a more powerful library, you can always load the one you need. The most frequently used one it MomentJS but we recommend a more recent iteration of the same idea by the actual author of MomentJS. It's called and can be used as follows: