Switching Timezones in Perl's Template::Toolkit plugin Template::Plugin::Date
- by aidan
I have a calendar on my website, generated in Perl using Template::Toolkit and Template::Plugin::Date.
It highlights the current day. I achieve this by iterating through all the dates (as I print the calendar) and comparing against the current date. Something like this:
[% IF cur_date == date.format(format = '%Y-%m-%d') %]
...
[% END %]
It all works well until someone in Australia looks at it. (They are in a different timezone to me and my server in the UK).
What's the best way to get Template::Plugin::Date to use a different time zone? It accepts a 'locale' parameter, but AFAIK this is only used for formatting.