At 8:49 PM +0100 12/2/03, Eugene van der Pijll wrote:
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.
I would agree. However, the year 0 should throw a warning that it is ambiguous.

How then would one distinguish between the two systems? Maybe new() takes an optional ISOyear parameter? Thus the default 'year' is the way we commonly think of it and can take optional BC/BCE/AD/CE coding. It treats -1 as 1 BC and dies on getting '0'. ISOyear can only take integers with an optional '-'.

Thus
year=>'1BC'
is the equiv of
ISOyear=>0


This will allow 'common usage' to work the way you expect, but allows other programs to know which behaviour they're plugging into. I think this is a better way of operating that setting a variable to determine which way we work.


But should new() know what to do when it receives the year '1381AH'?
'2756AUC'? '29BP'? '26 anno regni regis Iulianae'?
die("Huh? Ihay ontday peaksay atinlay. Orrysay");

Cheers!
Rick Measham

--
--------------------------------------------------------
            There are 10 kinds of people:
  those that understand binary, and those that don't.
--------------------------------------------------------
  The day Microsoft makes something that doesn't suck
    is the day they start selling vacuum cleaners
--------------------------------------------------------

Reply via email to