Skip to content

Fixed TimSpan Parsing#697

Merged
appel1 merged 4 commits intoExcelDataReader:developfrom
Hasan-75:fix/timspan-parsing-694
Apr 19, 2025
Merged

Fixed TimSpan Parsing#697
appel1 merged 4 commits intoExcelDataReader:developfrom
Hasan-75:fix/timspan-parsing-694

Conversation

@Hasan-75
Copy link
Contributor

Fixes #694

Investigation:

The issue was not with negative timespan.
Rather it was the different time-formats excel uses to save timespans or durations.

Excel can store timespans in different formats:

  1. ISO 8601 (i.e. P1DT2H30M)
  2. Excel Time Format (i.e. 12:34)

The code was parsing timespans using the method:
XmlConvert.ToTimeSpan(value.ToString()).

But this method can parse only ISO 8601 format timespans.
And the reported issue was happening because that file had timespan stored as Excel Time Format.

Solution

Added different parsing approaches for ISO 8601 timespans and Excel Time Format timespans.

@appel1 appel1 merged commit ce4aeb0 into ExcelDataReader:develop Apr 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug ?] Trying to read a cell with a negative TimeSpan causes a FormatException

2 participants