Eugene van der Pijll <[EMAIL PROTECTED]> wrote:
> ISO8601 obviously uses the astronomical convention. Dave
> evidently uses the Dionysian reckoning. I think this is the
> correct choice: if I want to create a date in 44BC, I'd prefer
> to say
>
> $dt = DateTime->new( year => -44, month => 3, day => 'Ides' );
>
> to
>
> $dt = DateTime->new( year => -43, month => 3, day => 'Ides' );
If you want "44BC", you should be able to use exactly that! :-)
Alas, the current API is a bastard -- an odd mixture of the two
and doesn't match *any* convention: It doesn't match the "44 BC"-
type notation since you have to use a leading "-" rather than the
trailing "BC", which is not very intuitive; and it doesn't match
the astronomical convention since it doesn't allow a year zero,
although since the year is specified simply as an integer it looks
like the astronomical convention is used.
Go for the path of least surprise and allow both, by changing
# if user gives us year -10 that's really -9 to us, since we start
# at year 0 internally
$args{year}++ if $args{year} < 0;
into
# convert "BC" year notation
$args{year} = 1 - $1 if $args{year} =~ /^\s*(\d+)\s*BC/;
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;