Skip Menu |

This queue is for tickets about the DateTime-Calendar-Chinese CPAN distribution.

Report information
The Basics
Id: 40591
Status: open
Priority: 0/
Queue: DateTime-Calendar-Chinese

Owner: Nobody in particular
Requestors: AERO [...]

Bug Information
Severity: Important
Broken in: 0.07
Fixed in: (no value)

Download (untitled) / with headers
text/plain 1.7k
Hello I want to covert between solar and lunisolar dates. so I tried with the following sample code. --------------------cut---------------------- #!/usr/bin/perl use strict; use warnings; use DateTime; use DateTime::Calendar::Chinese; # solar:2004-03-20 , lunisolar: 2004-02-30 my $d=DateTime->new(year=>2004,month=>3,day=>20,time_zone=>'Asia/Taipei'); my $l=DateTime::Calendar::Chinese->from_object(object=>$d); print $l->cycle," ",$l->cycle_year,"\n"; print +(-2697+$l->cycle*60+$l->cycle_year)," ",$l->month," ",$l->day,," ",$l->leap_month,"\n"; # solar:2004-03-21 , lunisolar: 2004-02-01 leap month my $d2=DateTime->new(year=>2004,month=>3,day=>21,time_zone=>'Asia/Taipei'); my $l2=DateTime::Calendar::Chinese->from_object(object=>$d2); print $l2->cycle," ",$l2->cycle_year,"\n"; print +(-2697+$l2->cycle*60+$l2->cycle_year)," ",$l2->month," ",$l2->day,," ",$l2->leap_month,"\n"; # lunisolar: 2004-02-30, solar:2004-03-20 my $l3=DateTime::Calendar::Chinese->new(cycle=>78,cycle_year=>21,month=>2,day=>30,time_zone=>'Asia/Taipei'); my $d3=DateTime->from_object(object=>$l3); print $d3->year," ",$d3->month," ",$d3->day,"\n"; # lunisolar: 2004-02-01 leap_month, solar:2004-03-21 my $l4=DateTime::Calendar::Chinese->new(cycle=>78,cycle_year=>21,month=>2,day=>1,leap_month=>1,time_zone=>'Asia/Taipei'); my $d4=DateTime->from_object(object=>$l4); print $d4->year," ",$d4->month," ",$d4->day,"\n"; --------------------cut---------------------- As you can see the conversion table at I expected 78 21 2004 2 30 0 78 21 2004 2 1 1 2004 3 20 2004 3 21 but output was not what I expected. :( 78 21 2004 2 30 0 (Correct) 78 21 2004 2 1 0 (Wrong) 2004 4 18 (Wrong) 2004 4 19 (Wrong)
Download (untitled) / with headers
text/plain 301b
yeah, what can I say. This was one my first modules, and I must say the interface and the code sucks. I've always wanted to fix it, but in order to do that I need to fix a bunch of planetary calculation related stuff, which I don't currently have the time for. Patches, suggestions are most welcome

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to