Repository navigation
Fix EDATE returning 28 February instead of 29 February in leap years #1781
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
Open
GreenFlux
wants to merge
3
commits into
develop
Choose a base branch
from
fix/edate-leap-year-february
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+12
−7
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I measured this in Excel Online (not desktop).
DAY(60)is 29, but noEDATEorEOMONTHresult is ever serial 60.=EDATE(DATE(1900,1,31),1)gives 59 (28 Feb) and=EDATE(60,1)gives 89 (29 Mar), so only the February clamp is 28. Excel keeps the fake leap day in the serial-to-date mapping only. Its month arithmetic treats February 1900 as 28 days.With
leapYear1900: trueandnullDate1899-12-31, the setup the compatibility guide recommends, 16 of my 450 start/offset cases now return 60 wheredevelopreturned 59 (for exampleEDATE(DATE(1900,3,31),-1)). Another 161 moved closer to Excel.I wouldn't special-case 1900.
EOMONTHondevelopalready returns 60, andDATE(1900,2,29)is valid in that mode. A row inlist-of-differences.mdcovering both functions should be enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, agreed on all points. I've kept the code as is, reworded the description so it no longer claims the 1900 result matches Excel, and added a row to
list-of-differences.mdcovering bothEDATEandEOMONTHunderleapYear1900. The Excel values in that row are from your Excel Online measurement, so let me know if you'd rather phrase them differently.I also rebased both branches onto
developto clear a changelog conflict; the earlier browser-test failures were theVERSIONspecs from the paired tests branch lagging behind the HF-307 test updates, not this change.