1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/date] [DOC] Fix about calendars difference

https://github.com/ruby/date/commit/0ae93e26aa
This commit is contained in:
Nobuyoshi Nakada 2022-08-08 21:13:52 +09:00 committed by git
parent 1607c6d281
commit 289d219758

View file

@ -4,19 +4,16 @@ The difference between the
{Julian calendar}[https://en.wikipedia.org/wiki/Julian_calendar] {Julian calendar}[https://en.wikipedia.org/wiki/Julian_calendar]
and the and the
{Gregorian calendar}[https://en.wikipedia.org/wiki/Gregorian_calendar] {Gregorian calendar}[https://en.wikipedia.org/wiki/Gregorian_calendar]
may matter to your program if it uses dates in the interval: may matter to your program if it uses dates before the switchovers.
- October 15, 1582. - October 15, 1582.
- September 14, 1752. - September 14, 1752.
A date outside that interval (including all dates in modern times) A date will be different in the two calendars, in general.
is the same in both calendars.
However, a date _within_ that interval will be different
in the two calendars.
=== Different Calendar, Different \Date === Different switchover dates
The reason for the difference is this: The reasons for the difference are religious/political histories.
- On October 15, 1582, several countries changed - On October 15, 1582, several countries changed
from the Julian calendar to the Gregorian calendar; from the Julian calendar to the Gregorian calendar;
@ -25,10 +22,12 @@ The reason for the difference is this:
- On September 14, 1752, most of the British empire - On September 14, 1752, most of the British empire
changed from the Julian calendar to the Gregorian calendar. changed from the Julian calendar to the Gregorian calendar.
When your code uses a date in this "gap" interval, When your code uses a date before these switchover dates,
it will matter whether it considers the switchover date it will matter whether it considers the switchover date
to be the earlier date or the later date (or neither). to be the earlier date or the later date (or neither).
See also {a concrete example here}[rdoc-ref:DateTime@When+should+you+use+DateTime+and+when+should+you+use+Time-3F].
=== Argument +start+ === Argument +start+
Certain methods in class \Date handle differences in the Certain methods in class \Date handle differences in the