freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Barnes (JIRA)" <>
Subject [jira] [Commented] (FREEMARKER-95) Wrong day of the week shown for the Thai locale
Date Thu, 26 Apr 2018 18:04:00 GMT


James Barnes commented on FREEMARKER-95:

Thank you for such a quick response! So I think the issue is that when I set the locale to
Thai in FreeMarker with code that looks like this:
room=<#setting locale="th_TH"><#setting date_format="yyyy-MM-dd">คุณมีการจองใหม่สำหรับวันที่
FreeMarker uses the Buddhist calendar to look up the day of the week, without first converting
the year. So if the day in question were today (Thursday April 26 2018), FreeMarker returns
Wednesday April 26 2018 in Thai, but is actually referring to Wednesday April 26 1475. Initially,
I also thought it might have been an issue with Java 8 as well, but if I run this simple Java:
String date_s = " 2018-04-26";

        SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd");

        Locale th_TH = new Locale("th", "TH");

        try {

            Date date = dt.parse(date_s);

            SimpleDateFormat dt1 = new SimpleDateFormat("EEEE MM-dd-yyyy", th_TH);

            SimpleDateFormat dt2 = new SimpleDateFormat("EEEE MM-dd-yyyy");



        } catch(Exception e){


I get the correct day of the week and year: วันพฤหัสบดี 04-26-2561 (Thursday
04-26-2018). We are actually only interested in the date itself, so no timezones are being
passed, just "MM-dd-yyyy". Let me know if you have any clarification questions on our use

> Wrong day of the week shown for the Thai locale
> -----------------------------------------------
>                 Key: FREEMARKER-95
>                 URL:
>             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

View raw message