Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be Excel-compatible when handling pre 1900-03-01 dates #146

Merged
merged 4 commits into from
Sep 17, 2021

Conversation

MarceloZabini
Copy link
Contributor

This hopefully fixes #145.
Although this should bring us closer to Excel, it does break compatibility, so it's probably worth mentioning in the changelog?

Thanks for your work and please let me know any changes you might want!

@MarceloZabini
Copy link
Contributor Author

I forgot to attach a screenshot of Online Excel that may or may not help reviewing. Cells in the same row are equal but with different formatting:

image

Copy link
Owner

@qrilka qrilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a changelog entry makes total sense.
As for the PR itself - only a minor comment about haddocks, otherwise LGTM.

fractionOfOneDay = realToFrac diffTime / (24 * 60 * 60)
-- For historical reasons, Excel thinks 1900 is a leap year (https://docs.microsoft.com/en-gb/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year).
-- So dates strictly before March 1st 1900 need to be corrected.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about moving this into haddock to make it visible to people using the function? For sure dateFromNumber gives some insight but that's a function for the opposite conversion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've changed the haddocks to contain this link and some more info as well, and noticed that this new behaviour makes dateFromNumber and dateToNumber no longer inverses of each other under certain circumstances, which I also documented.

@MarceloZabini
Copy link
Contributor Author

I added an entry in the changelog but I don't know how you want to handle versioning, so feel free to change, suggest a change or just ask me to change something there.

@qrilka
Copy link
Owner

qrilka commented Sep 16, 2021

Sorry, was a bit busy - I plan to take a look into it this evening

@qrilka
Copy link
Owner

qrilka commented Sep 17, 2021

I think your change makes sense, I want to release a new version with #144 merged so could change the version but that's not done yet.

@qrilka qrilka merged commit 624b0e4 into qrilka:master Sep 17, 2021
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.

Handling dates before 1900-03-01
2 participants