Skip to content

Fix: missed culture in date-time conversions#8

Open
Shiko1st wants to merge 6 commits intoPierluigiMari:mainfrom
Shiko1st:fix/date-culture
Open

Fix: missed culture in date-time conversions#8
Shiko1st wants to merge 6 commits intoPierluigiMari:mainfrom
Shiko1st:fix/date-culture

Conversation

@Shiko1st
Copy link

@Shiko1st Shiko1st commented Jan 8, 2026

Changes fix problems with missed culture in parsers and tests failed when local culture is non-western.

  1. Both parsers didn't use configured culture in default excel date conversion.
  2. All date-time converters now use the same function to convert incoming string to double. The function tries to adjust the incoming string into form with invariant decimal separator and then parse it to double using invariant number format.
  3. Both ExcelDateTimeOffsetConverterTests and ExcelDateTimeOffsetTextConverterTests had hardcoded timeshift in test data. This was rewritten with respect to actual local time shift.
  4. Parser tests were generalized, hardcoded strings and values were eliminated. The same data as used when writing sample sheet is used to compare with. The same culture as configured for parser is now used in comparison to convert date-time values to strings.
  5. Writer tests were generalized, hardcoded strings and values were eliminated. The same data as used when writing is used to compare with. Writing map is taken into account when performing validation. We belive that converter works correctly as it tested elsewhere so we are free to use it to convert stored value back instead of manually convert it each time. The very big test file was splitted into several parts (with mock data, with general purpose assertion methods, with test methods, with class maps).

The planned development is to use non-US and non-Invariant cultures to test parsers and writer.
p.s. sorry for such a big rewrite but I'm very interested in this library and its evolution so I was needed to ensure it will work and pass tests in my environments. Thas is why I've started all this.

Vladislav Kiselev added 6 commits January 8, 2026 15:19
… (no hardcoded shift anymore) when local culture is non-western.
… eliminated.

Model data is created once then used as expectation to compare actual values with.
Culture is used where was missed.
…machine is non-western.

All and any mock data were extracted into fields or constants, then used as expectation to compare actual values with. All hardcoded strings or values have been eliminated.
Actual values are now compared with respect to used ClassMap. No more hardcoded comparison transformations (we belive that used conversions are correct as they should be tested elsewhere). All comparisons are unified, the same data as written is used in validations.
Cell address in excel-style (like A1) is used to identify the cell being validated.
…culture and then parse it. This approach seems to be more universal.
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.

1 participant