dhatim / fastexcel

Generate and read big Excel files quickly
Other
647 stars 116 forks source link

ZonedDateTime isn't converted to correct time zone #304

Open gpsfl opened 1 year ago

gpsfl commented 1 year ago

A call to value(int r, int c, ZonedDateTime value) should write the time in the correct time zone. Right now it always writes the date in the system time zone. This worked correctly in previous versions.

From what I can tell the issue came from this commit: https://github.com/dhatim/fastexcel/commit/e0e4156184b53530372fa61339f205147fa33bdf

Before the convertDate method had a time zone parameter and was called with the time zone of the ZonedDateTime. Now it's only called with a date.

I think the easiest way to fix this would be to convert the ZonedDateTime using .toLocalDateTime() and then call the convertDate(LocalDateTime date) method.