[Fwd: Re: [fpc-devel] Magic numbers used in TryEncodeDate]
kuifwaremailinglists at xs4all.nl
Sun Apr 23 17:11:51 CEST 2006
Oops, I see that in the posting mess of this thread I replied to the wrong email address -- I sent the below to Graeme's personal email instead of the list. (Note: a few minutes ago I suddenly saw my other messages appear in the list, along with some other messages posted in the past days; in the light of Florian's 'Test, please ignore' message I assume something was up with the mailing list.)
-------- Original Message --------
Subject: Re: [Fwd: Re: [fpc-devel] Magic numbers used in TryEncodeDate]
Date: Sat, 22 Apr 2006 12:09:46 +0200
From: Bram Kuijvenhoven <kuifwaremailinglists at xs4all.nl>
To: Graeme Geldenhuys <graemeg.lists at gmail.com>
References: <444965A8.4060703 at kuijvenhoven.net> <cfcebe780604220153u47b0f40bne9484b959f86d20b at mail.gmail.com>
(I hope that this email arrives at the mailing list...)
Graeme Geldenhuys wrote:
> Now to add another problem. What happens with dates like 1752-09
> which only has 20 days. Shouldn't this affect the DeltaDate? Should
> Encode/DecodeDate know that for that month, 1752-09, there never
> existed the days 3rd thru 13th. The correct days for September was 1,
> 2, 14, 15, ... or should that be the worries of the Calendar Component
> displaying that month and not Encode/DecodeDate's problem?
IIRC this is commonly solved by differentiating between th Gregorian and Julian Calendar. I.e. the EncodeDate function etc. work with the Gregorian Calendar. Before that date in 1752 people used the Julian Calendar, but we map all TDateTimes to Gregorian dates.
As far as I know FPC does not have a system like Java, which was designed to work with any calendar. (also think of Chinese, Hebrew, ...) Having such a date system (perhaps in a separate unit) could allow us to have functions mapping things to Julian, Gregorian and mix-type dates (i.e. Julian before 1752/9 and Gregorian after).
Note that TDateTime is giving a universal time scale, but that mapping between different calendars needs different routines. Since historical dates, mentioned in historical documents might be Julian-based, it might be useful for some people to be able to deal with more or mixed calendars. But then they might want to be able to deal with BC as well!
But I recommend looking these things up somewhere before writing it down in the docs. (i.e. about the precise meaning of the Gregorian vs. the Julian calendar) This is just my IIRC :)
More information about the fpc-devel