Page MenuHomePhabricator

Some Julian dates are internally confused with Gregorian dates
Closed, ResolvedPublic


Author: ettore.callegari

if I #set the date 20 july 1283
when I #show the date, the date is not correct (13 luly 1283)

in this page
the source code is: {{#set:Data documento=20 lug 1283}}

in the preview, at the end of the page there is a box that shown the correct data:

Fatti riguardanti Codice Pelavicino n. 403Feed RDF
Data documento 20 luglio 1283
it is correct, but in this page:
the source code is: {{#show:Codice Pelavicino n. 403|?Data documento}}
but the data shown is: 13 luglio 1283

what is strange is that this two pages list the page
the pages are:

I apologize for my english, Ettore

Version: unspecified
Severity: normal



Event Timeline

Confirmed. The problem is cause by converting between different calendar models. Dates before 4 Oct 1584 are assumed to be in Julian calendar. SMW correctly recognises this here.

However, this information is not stored correctly. SMW currently assumes all stored dates to be in Gregorian calendar, but this conversion does not happen anywhere. So the Julian date gets stored without any indication that it is Julian. On reloading, SMW considers the date to be Gregorian, and converts it to Julian for display.

There are two ways in which we could fix this: (1) convert all dates to Gregorian before storing them or (2) store the calendar model with each date. The former would be easier, but it could create problems with conversion precision.

We may also need a better way to show if a date is Gregorian or Julian. But we do not want to write "Gr" or "Jl" next to every date. Suggestions are welcome.

Fixed in for SQLStore3. This change affects the way that data is stored in the database, so it is necessary to refresh the data to get the dates back. Dates stored in the old format will no longer be accessible.

The change also adds support for new output formats "Gr" and "Jl" that can be used in #ask to define the desired calendar model that should be displayed. The same strings also work as modifiers when writing dates. If nothing is given, SMW will assume the same default calendar model on input and on output. The new output formats do not depend on whether you are using SQLStore2 or SQLStore3.

The original problem will not be fixed for SQLStore2, which is supposed to be replaced by SQLStore3 on the next release (it will remain available for the next version but it will not get improvements/bugfixes).

(In general, there are still changes to come for SQLStore3 that may require rebuilding the database to upgrade.)