[
https://issues.apache.org/jira/browse/FREEMARKER-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16455554#comment-16455554
]
Daniel Dekany commented on FREEMARKER-95:
-----------------------------------------
Is {{payload.bookingDate}} a {{String}}, which stores the date in Gergorian
format? Because then of course you get the result what you get. As your locale
is {{th_TH}}, the string is interpreted according to that locale. My example
works because it uses ISO format, which is always interpreted as Gergorian.
To avoid such problems, either use {{java.sql.Date}} (maybe {{java.util.Date}})
for {{payload.bookingDate}}, or use ISO format. (Or, use Thai format, but
that's not an option if you serve multiple locales.)
As of a date-only value has no time zone attached... FreeMarker is based on
traditional Java date/time handling (i.e., {{java.util.Date}}), where time
zones matter even then. So be careful about that... (Like there's an example of
that kind of mess: [SQLDateAndTimeTimeZone
setting|https://freemarker.apache.org/docs/api/freemarker/core/Configurable.html#setSQLDateAndTimeTimeZone-java.util.TimeZone-])
> Wrong day of the week shown for the Thai locale
> -----------------------------------------------
>
> Key: FREEMARKER-95
> URL: https://issues.apache.org/jira/browse/FREEMARKER-95
> Project: Apache Freemarker
> Issue Type: Bug
> Reporter: James Barnes
> Priority: Major
>
> Freemarker returns the wrong day of the week when the user sets the the
> locale to Thai. It would seem that this is a result of Freemarker not
> correcting for the Buddhist calendar. The day of the week is currently out of
> sync but will be back in sync on Feb 28 2019 and then will be out of sync
> again on Feb 29 2020. So currently when the user sets the locale to Thai,
> FreeMarker uses the days of the week from 1475 on the Gregorian calendar.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)