[
https://issues.apache.org/jira/browse/FREEMARKER-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452564#comment-16452564
]
Daniel Dekany commented on FREEMARKER-95:
-----------------------------------------
I have tried this:
{code:java}
<#setting locale='th_TH'>
<#setting timeZone='GMT+7'>
${'2018-04-25T12:00Z'?datetime.iso?string("EEEE, z")}
{code}
and it outputs this:
{code:java}
วันพุธ, GMT+07:00
{code}
That's Wednesday (as it is in Europe for example), and I take that's wrong.
But, I have checked and FreeMarker uses a {{sun.util.BuddhistCalendar}} there,
not the Gergorian calendar. So I wonder why the result is still wrong. Is it
possible that Java (1.8.0_144 on Windows 7 64 bit in my case) doesn't support
this calendar properly? Or, that the {{BuddhistCalendar}} has some country
specific options that Java doesn't set according your locale? That is, can you
make pure Java output the correct day? Here's the piece of code I have tried,
and it prints the same as the template:
{code:java}
Locale locale = new Locale("th", "TH");
System.out.println(locale.getDisplayName());
SimpleDateFormat sdf = new SimpleDateFormat("EEEE\nz", locale);
sdf.setTimeZone(TimeZone.getTimeZone("GMT+7"));
System.out.println(sdf.getCalendar());
System.out.println(sdf.format(new Date()));
{code}
> 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)