When writing to a worksheet, the timezone of the first non-na value in a datetime column is used to calculate Excel compatible datetimes for all values in the column.
If the first non-na value's timezone is EST/EDT, then other values in the column that are EDT/EST will be offset improperly by -/+ 1 hour.
## [1] '4.1.0'
## a b
## 1 2018-03-12 11:00:00 EDT 2018-03-10 11:00:00 EST
## 2 2018-03-10 12:00:00 EST 2018-03-12 10:00:00 EDT
See also issue #424.
Fix
This PR adapts the existing code so that all values' timezones in a datetime column are considered rather than only the first non-na value's timezone.
Benchmark
Using all values for the Excel datetime calculation is more computationally expensive. This simple benchmark indicates that the cost is < 1 second increase per 100K datetime values written.
Issue
When writing to a worksheet, the timezone of the first non-na value in a datetime column is used to calculate Excel compatible datetimes for all values in the column.
If the first non-na value's timezone is EST/EDT, then other values in the column that are EDT/EST will be offset improperly by -/+ 1 hour.
See the below example.
See also issue #424.
Fix
This PR adapts the existing code so that all values' timezones in a datetime column are considered rather than only the first non-na value's timezone.
Benchmark
Using all values for the Excel datetime calculation is more computationally expensive. This simple benchmark indicates that the cost is < 1 second increase per 100K datetime values written.