Peter J. Acklam schreef:
> ISO 8601 includes an expanded format which allows years outside of
> the range [0000,9999]. However, this expanded format should not
> be used unless it has been agreed upon by all parties involved.
And I don't agree, so there! ;-)
> If iso8601() does not allow years outside [0000,9999], then it
> should return undef() rather than some non-ISO 8601 format, I think.
Probably.
> By the way, how do you know
> what the standard requires if you haven't read it? ;-)
I trust you completely. Unfortunately, ISO 8601 isn't avaliable online,
and none of the summaries I've read contain the expanded format.
I have only found RFC 2550, which may or may not be relevant here.
> > On your other point: I think it would be nice if DateTime::new
> > would accept years like '1974AD', '44BC, '2003CE' and '753BCE'.
> > But most people would say the year -753 meant 753 BC, so I would
> > keep that definition.
>
> This implies that someone converting from an ISO 8601 format must
> subtract one from the year if year <= 0 before feeding the value
> into the DateTime constructor.
Yes. Or they can use the parameter 'year_0'...
Dave, you've provided the day_0, month_0, year_0 methods to get these
values; perhaps one should also be able to use these as constructor
parameters?
> > But should new() know what to do when it receives the year
> > '1381AH'? '2756AUC'? '29BP'? '26 anno regni regis Iulianae'?
>
> First of all, the year input to the constructor must be a year in
> the Gregorian calendar. Secondly, adding one format ("BC" or
> whatever) doesn't imply that one must add everything under the
> sun.
True. But these formats will be available in a module, I'm sure. As will
the RFC 2550 format.
Eugene