Regression: v2.2.1 returns date field as an integer but used to be datetime field in any previous versions

Issue #447 resolved
C. W. created an issue

Hi

Please refer to the attached spread sheet. via openpyxl, cell('A2') used to return ‘2014-12-25 00:00:00’ but v2.2.1 returns 41998.

Please have a look.

Cheers

Comments (6)

  1. CharlieC

    The custom number formats are not parsing as relating to datetime values. Unfortunately, Excel treats datetimes as numbers unless the formatting is right and we use the same logic in openpyxl. I don't know what created the file but saving it Excel resolves the problem.

  2. CharlieC

    It looks like the uppercasing in the format is what's tripping the detection up. This is easy enough to fix but I wonder the formats should also be normalised to lower case as Excel seems to do.

  3. CharlieC

    Always lowercase formats when checking for datetimes. Might want to normalise number formats as lowercase except for values contained in square brackets. Resolves #447

    → <<cset cd75a2a640c3>>

  4. CharlieC

    @fuhrysteve glad to know it works for you. Will probably do release before then end of the month to allow time for any other bug fixes to be included.

  5. Log in to comment