diff options
| author | Artem Kozaev <[email protected]> | 2020-11-27 18:51:01 +0300 |
|---|---|---|
| committer | Artem Kozaev <[email protected]> | 2020-11-27 18:51:01 +0300 |
| commit | 155840c2772c964f9793683db7a2de95b7bd9027 (patch) | |
| tree | a95814de902ffa78b008a024c7d46ac2ab5ec4d0 /lib/axlsx/workbook/worksheet/cell.rb | |
| parent | 93ecd05c7ad587a60361b042ab9d692391e40e3b (diff) | |
| download | caxlsx-155840c2772c964f9793683db7a2de95b7bd9027.tar.gz caxlsx-155840c2772c964f9793683db7a2de95b7bd9027.zip | |
Add casting to date
Add tests
Diffstat (limited to 'lib/axlsx/workbook/worksheet/cell.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index a066ba91..9b87b894 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -475,7 +475,11 @@ module Axlsx case type when :date self.style = STYLE_DATE if self.style == 0 - v + if !v.is_a?(Date) && v.respond_to?(:to_date) + v.to_date + else + v + end when :time self.style = STYLE_DATE if self.style == 0 if !v.is_a?(Time) && v.respond_to?(:to_time) |
