That's the right behavior because DateTime represents a point in time. "2004" represents 1 year, a span of time.
What exactly do you want to do?
--d
Mark D. Anderson wrote:
There seems to be no support for keeping track of precision?
In particular, suppose my original string is "2004". I would like to later print that out as "2004", *not* as "2004-01-01", because somehow the DateTime object kept track of the level of precision.
But in this code: my $dt = DateTime->new(year => 2004); print "year=", $dt->year, " month=", $dt->month, "\n";
the output is: year=2004 month=1
I can't specify an illegal value like -1. And there is no way to turn off the builtin defaulting.
-mda
