Change from Gregorian to Julian calendar in Qt 4.2

David Jarvie lists at
Mon Sep 4 16:04:50 BST 2006

On Monday 4 September 2006 11:43, Thiago Macieira wrote:
>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 

It would be best to minimise the necessity to use non-default calendars. The choice of calendar really depends on the likely use of early dates.

>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.

If both calendars are going to be used for QDate, I would agree that 1582 is the most obvious cutoff.

>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 

But unfortunately QDate *can* be wrong for dates before 1582. The date at which the year number changed varied from country to country 
until 1st January was eventually adopted universally. (This happened as late as 1752 in England and Wales.) For example, in France the date 
the year number changed was Easter, so 2nd February 1500 in France would be the same day as 2nd February 1501 in countries which 
changed year on 25th December. So even if the month and day numbers might be predictable, you can't rely on year numbers. The result is 
that dates both before and after 1582 need to undergo locale conversion, although admittedly it's not quite so complicated with the Julian 

As for using the proleptic Julian calendar, I can't really see the sense in it (apart from avoiding the discontinuity between the proleptic 
Gregorian and the start of the Julian calendar). Wouldn't it be simpler to use the Gregorian calendar (proleptic or otherwise) throughout which 
would serve well for scientific purposes and require no more conversion than the Julian calendar would?

>Also note that QDate no longer accepts year 0: it counts now -3, -2, -1, 
>1, 2, 3, 4, ...

Which introduces an extra complication for anybody naively adding or subtracting years over the (non-existent) year 0 boundary.

Altogether, I'm not convinced about the desirability of the change. But I'd like to hear from people who might actually use pre-1582 dates (e.g. 
Nicholas Goutte or Jason Harris).

David Jarvie.

More information about the kde-core-devel mailing list