Change from Gregorian to Julian calendar in Qt 4.2

Thiago Macieira thiago at kde.org
Mon Sep 4 11:43:27 BST 2006


David Jarvie wrote:
>In the latest Qt 4.2 changes, QDate now uses the Julian calendar instead
> of the Gregorian for dates before 1582. In some ways, this makes even
> more of a mess of date handling than before due to the two calendar
> systems. Now, QDate uses Julian dates pre-1582 - which don't
> necessarily coincide with historical records since usage of the
> calendar wasn't properly standardised. It uses Gregorian dates
> post-1582 - but because most countries didn't adopt the Gregorian
> calendar until long after 1582, this often doesn't coincide with
> historical records either until the 20th century. For scientific
> purposes, the Gregorian calendar is universally used both pre- and
> post-1582.
>
>The question for KDE is, should the KDateTime class follow QDate in the
> switch to the Julian calendar (which will happen automatically as
> things stand since it uses QDateTime internally), or should it be
> changed to use a different internal representation for date/time values
> so as to continue to use the Gregorian calendar throughout?

KDE understands the concept of calendar, so it should use what the 
calendar specifies. If we're looking at the non-Gregorian, non-Julian 
calendars, there should be rules for converting the date into Julian 
Days.

For those that are using the Julian calendar (say, the Russian Orthodox 
Church -- are they using KDE?), it's also straightforward: conversion 
from Julian Day to Julian Date is required.

As for the countries that use the Gregorian calendar, the calendar varies 
from country to country. There are *very* locale-specific for that and I 
doubt we have them implemented anywhere. Some countries converted from 
Julian to Gregorian before others; some went back from Gregorian to 
Julian (Scotland), some went halfways, then decided to go back and 
introduced a February 30th (Sweden). This kind of complexity lies surely 
out of Q/KDateTime. There's only one universally accepted date for the 
beginning of the Gregorian calendar and it's the one QDate now uses.

What may be argued is if QDate shouldn't use the proleptic Gregorian 
calendar into the past, like I had originally made it do. I tried to 
argue this point with the Trolltech developer who made the change, but we 
ended up concluding that conversion rules are necessary for any date 
after the first introduction of the Gregorian calendar, but not before. 
That way, at least before 1582, QDate cannot be wrong WRT historical 
records.

Also note that QDate no longer accepts year 0: it counts now -3, -2, -1, 
1, 2, 3, 4, ...
-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060904/2735e9a6/attachment.sig>


More information about the kde-core-devel mailing list