andersnm/ExcelNumberFormat

TimeSpans with milliseconds are trimmed rather than rounded

Pankraty opened this issue · 2 comments

Consider a timespan 1:25.500 formatted as [h]:mm:ss.

Currently, the result is 0:01:25 while the correct result should be 0:01:26, according to rounding rules.

Moreover, in .Net Core 3.0, the precision used for storing TimeSpans has changed, and now the value new TimeSpan(1, 2, 31, 45) may be presented as 26:31:44.999999 internally, which causes an incorrect result during formatting: 26:31:44.

I've prepared a fix for both these issues.

Related issue: ClosedXML/ClosedXML#1318

Thanks! It's been released to Nuget as 1.0.10 with some tweaks and a fix for negative durations.

Great! Thank you very much!