Bug 64143 - Custom date formats rely on JVM user locale instead of LocaleUtil in DataFormatter
Summary: Custom date formats rely on JVM user locale instead of LocaleUtil in DataForm...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 4.1.1-FINAL
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-14 12:50 UTC by James Harrison
Modified: 2020-02-14 12:58 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Harrison 2020-02-14 12:50:21 UTC
The DataFormatter class creates a new ExcelStyleDateFormatter for custom date formatting which is a subclass of SimpleDateFormat. However, it never calls setTimeZone which means it relies on the user.timezone and cannot be overridden.

For the default date format, setTimeZone is called with the time zone from LocaleUtil, which allows for the zone to be overridden on a per-thread basis.

I have a use case for reading formatted dates from an Excel file using as UTC, but this only works if the JVM user.timezone is set to UTC, which I cannot guarantee.
Comment 1 PJ Fanning 2020-02-14 12:58:00 UTC
would have time to look at doing a patch?