Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this address?
Using
fast_excel
to writeTime
orDateTime
to XLSX corrupts the result when the timezone is not+00:00
.While exposing the issue, this was the result of converting various input values via
FastExcel::WorksheetExt#write_value
:Only the
+00:00
offsets work as expected, which are the only use cases originally tested.What have I done to solve this?
I've expanded the test cases to expose the problem and then applied a fix that ensures
DateTime
andTime
use non-destructive calls to convert timestamps to be in+00:00
before writing them to XLSX.I've tested it locally on Ruby 2.7.5. If older Rubies break, CI should show us.
Refactoring
Because of the (now) large number of test cases that duplicate the logic for writing a value to XLSX and reading it back, I've added a helper method to the test file to encapsulate this. The test cases are now much easier to read.