Hello,
Here's a patch to fix a problem where a cell whose format is set to datetime actually contains a string.
In my case I had a cell with string "823.63" but its format was set to datetime. The `_datetime` method coerces its argument to a float in `date = base + data.to_f`, but in the very next line it doesn't coerce: `hour = (data % 1) * 24`. If `data` is a string this will lead to a NoMethodError two lines later when the `round` message is sent to `sec`.
Apologies if this isn't the preferred way of submitting patches. I looked around but couldn't find an alternative.
diff --git a/lib/spreadsheet/excel/row.rb b/lib/spreadsheet/excel/row.rb
index eadca74..b9b906b 100644
--- a/lib/spreadsheet/excel/row.rb
+++ b/lib/spreadsheet/excel/row.rb
@@ -58,7 +58,7 @@ class Row < Spreadsheet::Row
return data if data.is_a?(DateTime)
base = @worksheet.date_base
date = base + data.to_f
- hour = (data % 1) * 24
+ hour = (data.to_f % 1) * 24
min = (hour % 1) * 60
sec = ((min % 1) * 60).round
min = min.floor
Many thanks,
Andy Stewart