Date format only dates
Created originally on Bitbucket by robertkarl (Robert Karl)
Some financial formats for cryptocurrencies cause amounts to be improperly interpreted as dates. Original issue here.
In particular if a cell with value 3 is formatted like “3.0 ETH” you end up getting Jan 3, 1900 from openpyxl for that value.
This PR makes openpyxl examine date formats more carefully. In particular:
- As before, only examine the first part of the format before ';'
- To be considered a date, a format MUST contain one of
idmhysDMHYS
- To be a date, it can contain the above letters or P or A ie. AM or PM, but should not contain any other ascii characters.
That is enough for the tests to pass and ETH to not be considered a date.
TODO: Add a test for some cryptocurrency and currency quantities like ETH, BTC
TODO: I removed some tests to make them pass; they didn’t look like date formats; check this.
TODO: Check on requirements.txt change (I had to install jdcal for pytest to work)