I've created a report in Jaspersoft Studio (6.20.0) with Language set to "javascript" as I want to make use of JavaScript's eval() function.
I specified a field with the following expression:
( new Date ).toLocaleString( "en-US", {timeZone:"Pacific/Guam"} ) + "\n" +
( new Date ).toLocaleString( "de-DE", {timeZone:"CET"} )
When I run the report, the field is shown as:
Juni 20, 2024 1:49:32 nachm. MESZ
Juni 20, 2024 1:49:32 nachm. MESZ
Changing the REPORT_LOCALE or the REPORT_TIME_ZONE parameters upfront does not have any effect on the result.
In comparison, running above's expression in an online JavaScript tester, I'll get the expected
6/20/2024, 9:49:32 PM
20.6.2024, 13:49:32
As the two lines from JasperReports are the same, it seems JasperReports does not regard the locale and the options parameters of the toLocaleString() method.
Is there some config setting or any other measures to make JasperReports recognize the locale and the options parameters?