Joshua Hoblitt schreef: > > This would also solve the following problem: > > > > $d = DateTime->new( year => 2003, month => 4, day => 3, > > hour => 0, minute => 0, second => 0 ); > > $md = DateTime::Calendar::Mayan->from_object( object => $d ); > > > > print $md->date, "\n"; # prints 12,19,10,2,10 > > > > $d = DateTime->new( year => 2003, month => 4, day => 3, > > hour => 0, minute => 0, second => 0, > > time_zone => 'Europe/Amsterdam' ); > > $md = DateTime::Calendar::Mayan->from_object( object => $d ); > > > > print $md->date, "\n"; # prints 12,19,10,2,9 > > I think thats correct behavior isn't it? The value for RD utc passed > will be different because the top example is a floating time.
It's correct behaviour, for some values of correct. But it is unexpected that 2003-04-03 is converted into 12,19,10,2,9, only because of the timezone. An even worse example: how do you print today's date? Wrong answer #1: print DateTime::Calendar::Mayan->now->date; This prints the Mayan date corresponding to the UTC date, which can be different from the local date. (Which can't be helped, as the local timezone isn't mentioned.) Wrong answer #2: print DateTime::Calendar::Mayan->from_object( object => DateTime->now(time_zone => 'Europe/Amsterdam') ); (assuming that now() accepts a timezone. if it doesn't, replace the DateTime object by DateTime->now->set_time_zone( 'Europe/Amsterdam' )) Because DT::C::Mayan converts from UTC, and does not keep the timezone info, this has the same result as answer #1. Correct answer: print DateTime::Calendar::Mayan->from_object( object => DateTime->now(time_zone => 'Europe/Amsterdam')-> set_time_zone => 'floating' )); > The easiest thing to do would be to catch that stuff in the > constructor. However I had assumed that a baktun could be 0-20 as 1 > pictun = 20 baktun. Do you have source of documentation you could > point me at? Look at all the websites saying the world will end in 2012. They are based on the Mayan calendar, which reaches it's "new year" (13.0.0.0.0) in December 2012. Or look at the calendar FAQ, as Abigail said. (The link can be found on http://datetime.perl.org .) Eugene