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

Leap year #22

Merged
merged 2 commits into from Mar 13, 2013
Merged

Leap year #22

merged 2 commits into from Mar 13, 2013

Conversation

pirxpilot
Copy link
Member

Fix leap year calculation:

  • take year into account when calculating number of days in a month
  • years 2000, 2400 etc. are leap years

Year number is needed for leap day calculation to work
Years divisible by 400 *are* leap years (iow: 2/29/2000 was on Tuesday)
see: http://en.wikipedia.org/wiki/Leap_year#Algorithm
@pirxpilot pirxpilot mentioned this pull request Mar 1, 2013
@jofan
Copy link

jofan commented Mar 13, 2013

Should also remove "|| (0 == year);" as year 0 is not a leap year.

tj added a commit that referenced this pull request Mar 13, 2013
@tj tj merged commit 63a23a4 into component:master Mar 13, 2013
@pirxpilot
Copy link
Member Author

There wasn't really the year 0. And this code does not really work for year < 1562 anyway. I was mostly concerned about the year 2000, but I am sure better patches will follow ;-)

@jofan
Copy link

jofan commented Mar 13, 2013

Right. I was just about to do a pull request when I saw your fix and having the check for year 0 doesn't really make or break anything so I'll leave it up to TJ. :)

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.

None yet

3 participants