Re: Jalali Calendar

2003-06-19 Thread Joshua Hoblitt
 It looks like the Jalali calendar is also called the Persian calendar,
 so DateTime::Calendar::Persian is a possibility too. I'm not familiar
 with this calendar, its most common name, and the way it is used, so you
 (Ahmad) should judge for yourself what name would be best.

In Calendrical Calculations it says the Jalali calendar used 30 day months while the 
Persian calendar used 29,30, and 31 day months.

-J

--



Re: Jalali Calendar

2003-06-19 Thread Eugene van der Pijll
Ahmad Anvari schreef:
 I would suggest registering DateTime::Calendar::Jalali
 for now.

If that's what most potential users would recognize, it's the right
name. I wouldn't have recognized it, but I'm not the intended audience.
(But I'll install it anyway...)

Eugene


Jalali Calendar

2003-06-18 Thread Flavio S. Glock
Ahmad:

The first step would be to write to [EMAIL PROTECTED],
in order to register your calendar in the
DateTime namespace.
It would probably be named DateTime::Calendar::Jalali.

Also, you could download one of the existing Calendars,
and take a look at the code:

  http://search.cpan.org/search?query=datetime%3A%3ACalendarmode=all

See also the Info for DateTime Developers

  http://datetime.perl.org/developer/

(forwarded to [EMAIL PROTECTED])

- Flavio S. Glock

Ahmad Anvari wrote:
 
 Hi Flavio,
 
 I took a look at datetime.perl.org project. Looks like
 a great one and I would be pleased to contribute to
 that.
 
 Please send me the guidelines and standards and I'll
 make Date::Jalali compatible with them so it can be
 added to the project.
 
 Best regards,
 
 _Ahmad


Re: Jalali Calendar

2003-06-18 Thread Eugene van der Pijll
Flavio S. Glock schreef:
 The first step would be to write to [EMAIL PROTECTED],
 in order to register your calendar in the
 DateTime namespace.
 It would probably be named DateTime::Calendar::Jalali.

It looks like the Jalali calendar is also called the Persian calendar,
so DateTime::Calendar::Persian is a possibility too. I'm not familiar
with this calendar, its most common name, and the way it is used, so you
(Ahmad) should judge for yourself what name would be best.

I don't think there's anyone else working on this, so no problems there.

 Ahmad Anvari wrote:
  Please send me the guidelines and standards and I'll
  make Date::Jalali compatible with them so it can be
  added to the project.

The most important point is that a DateTime::Calendar module does not
convert to Gregorian dates directly. Instead, it converts to a day
count. Implement a _utc_rd_values() which returns this day count. For
the reverse conversion, write a from_object() method. The new() method
should accept Jalali dates only.

In the algorithm in Date::Jalali-new(), you do the conversion
Gregorian - day count ($j_day_no, $g_day_no) - Jalali. Remove the
first half, and you (almost) have your from_object(). (There probably is
an offset between your day count and our day count; it looks like
$g_day_no starts counting in 1600, while our rata die count starts in
1AD. Subtract an appropriate constant from the count before the conversion.)

See http://datetime.perl.org/developer/calendar.html for more
information. Ignore the time and timezone information for now (but it
would be nice to add time to your module in future, especially because
Jalali days apparently begin on noon instead of on midnight, and
Gregorian-Jalali date conversions therefore depend on the time of day...).

Perhaps the simplest example of an implementation of the conversion
methods is in my DateTime::Calendar::Pataphysical (see
http://search.cpan.org/src/PIJLL/DateTime-Calendar-Pataphysical-0.02/lib/DateTime/Calendar/Pataphysical.pm
for the source code).

By the way, do you know anything about the algorithm you're using? It
seems that the leap days are defined by astronomical observation (years
always start on the spring equinox in Teheran). There are several
algorithms to predict this day, but they are not perfect outside of a
certain time interval (see for example:
http://www.projectpluto.com/calendar.htm#jalali). Is there something like an official 
algorithm?

Eugene