weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.27k stars 253 forks source link

execute date_to_num when the data is Time #415

Closed RayYokoyama closed 2 years ago

RayYokoyama commented 2 years ago

This PR is to execute date_to_num when the data is Time.

before

cell = book[0].add_cell(0,0,'')
cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
cell.change_contents(Time.new)
cell.datatype
=> "str"

at excel

2022-02-23 13:42:46 +0900

after

...
cell = book[0].add_cell(0,0,'')
cell.set_number_format('ddd mmm dd, yyyy HH:MM:SS')
cell.change_contents(Time.new)
cell.datatype
=> nil

at excel

Wed Feb 23, 2022 04:38:40