Yes, this is better: $dtc1->set( month => 12 ); $dtc1->set( month => undef );
It can work without cloning, in order to be compatible with DateTime API. Name - how about DateTime::Whatever ? (I like it) $date = DateTime::Whatever->whatever( year => 2003 ); # 2003-xx-xxTxx:xx:xx $date = DateTime::Whatever->new( year => 2003, day => undef ) # 2003-xx-01-T00:00:00 And this is one of the lines I snipped from the previous mail: $date->add( months => 12 ) # 2004-xx-01-T00:00:00 - Flavio S. Glock Ben Bennett wrote: > > I like the idea (this is the partial date & time thing right?) but I > am not too sure about the name... unless you start dealing with times > with real and imaginary parts :-) (Not that I have any suggestions for > a name yet). > > Regarding the interface would it be better to have: > -- > my $dtc1 = DateTime::Complex->new_undef(); > # I assume that DT::C->new() assumes 0 like DT->new() > # but that DT::C->new(year => 2003, day => undef ) > # would give 2003-xx-01-T00:00:00? > > my $dtc2 = $dtc1->set( month => 12 ); > my $christmas = $dtc2->set( day => 24 ); > # Do these clone BTW or are $dtc1, $dtc2 and $christmas all refs > # to the same object (like DateTime does)? > > my $december = $christmas->set(day => undef); > > print $december->datetime; > # xxxx-12-xxTxx:xx:xx > > # See above question re cloning objects. > print $christmas->next( DateTime->now )->datetime; > # 2003-12-24Txx:xx:xx > > my $xmas_noon = $christmas->clone()->set( hour => 12 ); > > print $christmas->contains( $xmas_noon ); > # 1 > -- > > Regarding the cloning question, it is more like DateTime if they do > not get cloned autmomatically, but I am assuming your implementation > is based on your DT::Set which I think does clone automatically? I > would still vote for not cloning.
