Hi Thanks for creating an interesting package.
I'm trying to use DateTime::Calendar::Chinese to calculate public holidays for Hong Kong, as illustrated by this output from a test script, included below. For 2004, Chinese New Year is 22 January, and there is a leap month after the second lunar month. Buddah's Birthday is the 8th day of the 4th lunar month, so (taking into account the leap month) that is 26 May. My script returns 26 April. Similarly, Tuen Ng is the 5th day of the 5th month, that is 22 June, but my script returns 23 May. The table after "New Moons, Month starts" lists the dates of new moons, the first day of the month with leap_month => 0 and the first day of the month with leap_month => 1. There is no difference between the last two columns: setting leap_month does nothing. Any suggestions welcome. Regards Allan Dyer ----------------------- Base: 2004-01-01 00:00:00 Sui: 2004-01-22 12:00:00 Greg: 2004-01-22 12:00:00 New Moons, Month starts 2004-01-22 12:00:00 2004-02-20 00:00:00 2004-02-20 00:00:00 2004-02-20 17:17:39 2004-02-20 00:00:00 2004-02-20 00:00:00 2004-03-21 06:41:17 2004-03-21 00:00:00 2004-03-21 00:00:00 2004-04-19 21:21:08 2004-04-19 00:00:00 2004-04-19 00:00:00 2004-05-19 12:51:53 2004-05-19 00:00:00 2004-05-19 00:00:00 2004-06-18 04:26:42 2004-06-18 00:00:00 2004-06-18 00:00:00 2004-07-17 19:23:37 2004-07-17 00:00:00 2004-07-17 00:00:00 2004-08-16 09:23:41 2004-08-16 00:00:00 2004-08-16 00:00:00 2004-09-14 22:28:51 2004-09-14 00:00:00 2004-09-14 00:00:00 2004-10-14 10:48:05 2004-10-14 00:00:00 2004-10-14 00:00:00 2004-11-12 22:27:00 2004-11-12 00:00:00 2004-11-12 00:00:00 2004-12-12 09:28:52 2004-12-12 00:00:00 2004-12-12 00:00:00 Events Buddha's Birthday: 2004-04-26 00:00:00 Tuen Ng: 2004-05-23 00:00:00 ----------------------- ----------------------- #!/usr/bin/perl -w # # Test the Chinese date & time modules # - something is very strange use DateTime::Event::Chinese; use DateTime::Event::Lunar; use DateTime::Calendar::Chinese; use constant TZHK => 'Asia/Hong_Kong'; my ($year, $month, $day) = @ARGV; $year= 2004 unless $year; $month= 1 unless $month; $day= 1 unless $day; my $dt= DateTime->new( year => $year, month => $month, day => $day, time_zone => TZHK ); print "Base:\t", $dt->ymd, " ", $dt->hms, "\n"; my $new_year = DateTime::Event::Chinese->new_year_for_sui(datetime => $dt); print "Sui:\t", $new_year->ymd, " ", $new_year->hms, "\n"; my $new_year1 = DateTime::Event::Chinese->new_year_for_gregorian_year(datetime => $dt); print "Greg:\t", $new_year1->ymd, " ", $new_year1->hms, "\n"; $cycle = 78; $cy= $year - 2000 + 17; print "\nNew Moons, Month starts\n"; for (my $i=1; $i<=12; $i++) { $dt= DateTime::Event::Lunar->new_moon_after( datetime => $dt); my $cnm= DateTime::Calendar::Chinese->new( cycle => $cycle, cycle_year => $cy, month => $i, leap_month => 0, day => 1, ); my $nm= DateTime->from_object(object => $cnm); print $dt->ymd, " ", $dt->hms, "\t", $nm->ymd, " ", $nm->hms, "\t"; my $clnm= DateTime::Calendar::Chinese->new( cycle => $cycle, cycle_year => $cy, month => $i, leap_month => 1, day => 1, ); my $lnm= DateTime->from_object(object => $clnm); print $lnm->ymd, " ", $lnm->hms, "\n"; } print "\nEvents\n"; my $cbb= DateTime::Calendar::Chinese->new( cycle => $cycle, cycle_year => $cy, month => 4, leap_month => 0, day => 8, ); my $bb= DateTime->from_object(object => $cbb); print "Buddha's Birthday: ", $bb->ymd, " ", $bb->hms, "\n"; my $ctn= DateTime::Calendar::Chinese->new( cycle => $cycle, cycle_year => $cy, month => 5, leap_month => 0, day => 5, ); my $tn= DateTime->from_object(object => $ctn); print "Tuen Ng: ", $tn->ymd, " ", $tn->hms, "\n"; ----------------------- -------------------------------------------------------------------- Allan Dyer, CISSP, MHKCS, DFCAE | [EMAIL PROTECTED] Chief Consultant | http://www.yuikee.com.hk/ Yui Kee Computing Ltd. |