Description of problem: The leap year rule from Sept 1782 forward is the following All multiples of 100 are not leap years, unless the year is a multiple of 400. cal 2 1700 and cal 1700 -j cal 1701 is wrong too. (Starting date) Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
(In reply to Leslie Satenstein from comment #0) > cal 2 1700 > > and cal 1700 -j > > cal 1701 is wrong too. (Starting date) cal is from util-linux, not coreutils: % rpm -qf /usr/bin/cal util-linux-2.30.2-1.fc27.x86_64 > Version-Release number of selected component (if applicable): > > > How reproducible: > > > Steps to Reproduce: > 1. > 2. > 3. > > Actual results: > > > Expected results: > > > Additional info: Please use the template while reporting a bug. It is there for a reason.
cal(1) command uses the rule since year 1752 static int leap_year(int32_t year) { if (year <= REFORMATION_YEAR) return !(year % 4); else return ( !(year % 4) && (year % 100) ) || !(year % 400); } for all before 1752 it uses the original simple rule. It makes cal(1) backwardly compatible with calendars before the reformation :-) Frankly, I don't think there is a right solution -- apply new rules backwardly or since the date it was introduced?
Correction for the year. It is 1582, for the Gregorian decree Therefore 1600 was a leapyear 1700 not, 1800 not, 1900 not, 2000 yes const int32_t REFORMATION_YEAR = 1582; static int leap_year(int32_t year) { if (year <= REFORMATION_YEAR) return !(year % 4); else return ( !(year % 4) && (year % 100) ) || !(year % 400); } for all before 1582 it uses the original simple rule. It makes cal(1) backwardly compatible with calendars before the reformation :-) Frankly, I don't think there is a right solution -- apply new rules backwardly or since the date it was introduced?
date --date="1700-01-01 + 59 days" output: Mon Mar 1 00:00:00 LMT 1700 date --date="1700-01-01 + 58 days" output: Sun Feb 28 00:00:00 LMT 1700 So date and cal are inconsistent. ("date" from coreutils-8.27-6.fc26.x86_64)
Thank you Don, for the idea of matching to cal to date.
* Gregorian calendar was introduced it in October 1582 * in year 1752 it was reformation by Calendar (New Style) Act 1750 .. anyway it seems all tools use the simple rule !(year % 4) && (year % 100) ) || !(year % 400) for all years, so I think it's good idea to do the same in cal(1) to be compatible. Fixed in the upstream tree. Fedora package will be updated after upgrade to the new upstream.
1752 new style: http://www.legislation.gov.uk/apgb/Geo2/24/23/contents leap year: http://www.legislation.gov.uk/apgb/Geo2/24/23/section/2
Karel Thank you for the upstream correction to come. I believe the USA followed the Gregorian Calendar,as did Canada, (Québec/Ontario) from around the 1600's. Since I was not alive then to confirm this fact, my next reference will be the Farmer's Almanac circa 1792. I will inquire as to whether they have a publication with the calendar for 1792. It may shed some light as to when calendars were adopted.