Skip Menu |

This queue is for tickets about the Date-Converter CPAN distribution.

Report information
The Basics
Id: 130290
Status: new
Priority: 0/
Queue: Date-Converter

People
Owner: Nobody in particular
Requestors: J2N-FORGET [...] orange.fr
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Documentation for BC dates
As I was working on my Perl 6 module Date::Calendar::Hebrew, I have written some Common Lisp code and some Perl 5 code to convert Hebrew dates to Gregorian and compare four Perl 5 modules with Reingold's and Dershowitz's calendrica-3.0.cl in Common Lisp. The two source files and the result file are annexed to this RT ticket. As you can see in the result file, there are differences between calendrica-3.0.cl and Date::Converter. In my opinion, it is *unfair* to call these differences "errors". They all involve BC dates. I think that Date::Converter uses the historian way of dealing with BC dates while calendrica-3.0.cl uses the mathematician way. On the other hand, there is a *remote* possibility that Date::Converter is buggy with BC dates. Here is a more detailed explanation, ready for cut-and-paste =head2 Dates before the Epoch The following explanations apply to the Gregorian calendar, but the general idea applies to all calendars included in C<Date::Converter>. There are two ways of dealing with dates before a calendar's epoch, e.g. 1st January 1 AD for the Gregorian calendar: the mathematicians' way and the historians' way. The mathematicians consider that the numbering of the years follows the natural flow of the integer numbers. Before year 1 you have year 0 and before that, year -1, year -2 and so on. The eve of 1st January 1 AD is 31st December 0. 366 days before 1st January 1 AD is 1st January 0 (remember the leap year rule). And 367 days before 1st January 1 AD is 31st December -1. On the other hand, historians do not use a zero year. With their numbering scheme, the year before 1 AD is 1 BC. C<Date::Converter> uses the historian numbering. The only caveat is that "1 BC" is expressed as a numeric value C<-1>, "2 BC" as C<-2> and so on. end of copy-paste I have not checked how Date::Converter deals with the negative years in other calendars. If they behave differently from the Gregorian calendar, you will have to make some alterations to my explanation. I have supposed that the module implements all carendars in similar ways. You may also add this other paragraph =head3 Proleptic Calendar Some people may argue that the discussion above is pointless because there are no Gregorian dates before 15th October 1582. The Gregorian calendar used in this module is the I<proleptic> Gregorian calendar, that is, a calendar extending the Gregorian calendar into the past until the BC years, while keeping the Gregorian leap year rule and the fact that the beginning of the year is the 1st of January, not the 25th March or Easter or some other date. end of copy-paste And if my supposition about using the historians' numbering scheme is wrong, if the processing of negative years is actually a bug, can you fix the arithmetic in your module please? And while it is not the place in a bug tracker, I want to add: -- Many thanks to you for writing "Perl Deep Dive", which helped me a lot to write Perl 6 modules and Perl 6 code (similar thanks to Laurent and brian). -- Many thanks for writing Date::Converter, which was the basis for the algorithmic part of Date::Calendar::Hebrew. -- Many thanks for organizing several YAPC::EU conferences, plus a few days ago PerlCon in Riga.
Subject: comp-p5
Download comp-p5
application/octet-stream 6.1k

Message body not shown because it is not plain text.

Subject: comp-p5-result
Download comp-p5-result
application/octet-stream 5.7k

Message body not shown because it is not plain text.

Subject: cvt-he-gr.cl
Download cvt-he-gr.cl
application/octet-stream 1.9k

Message body not shown because it is not plain text.

Post-scriptum. I have read the source of Date::Converter and now I am sure, the differences I have found are definitely *not* a bug. They are the result of the functions y_common_to_astronomical and y_astronomical_to_common. I have rewritten my POD suggestions to use the same vocabulary as the Perl code. Here they are: =head2 Dates before the Epoch The following explanations apply to the Gregorian calendar, but the general idea applies to all calendars included in C<Date::Converter>. There are two ways of dealing with dates before a calendar's epoch, e.g. 1st January 1 AD for the Gregorian calendar: the astronomers' way and the common way, used among others by the historians. The astronomers consider that the numbering of the years follows the natural flow of the integer numbers. Before year 1 you have year 0 and before that, year -1, year -2 and so on. The eve of 1st January 1 AD is 31st December 0. 366 days before 1st January 1 AD is 1st January 0 (remember the leap year rule). And 367 days before 1st January 1 AD is 31st December -1. On the other hand, the common way does not use a zero year. With this numbering scheme, the year before 1 AD is 1 BC. C<Date::Converter> uses the common numbering. The only caveat is that "1 BC" is expressed as a numeric value C<-1>, "2 BC" as C<-2> and so on. =head3 Proleptic Calendar Some people may argue that the discussion above is pointless because there are no Gregorian dates before 15th October 1582. The Gregorian calendar used in this module is the I<proleptic> Gregorian calendar, that is, a calendar extending the Gregorian calendar into the past until the BC years, while keeping the Gregorian leap year rule and the fact that the beginning of the year is the 1st of January, not the 25th March or Easter or some other date (as was the case in various regions during the Middle Ages). end of copy-paste