eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
421 stars 179 forks source link

[feature] implement Julian calendar for fn:format-date #3879

Open claudia-sutter opened 3 years ago

claudia-sutter commented 3 years ago

The goal is to display the weekday, when a <date/ >, <origDate/ > or the like is written in the XML-code and processed by an .odd-file. Apparently, there is no $calendar parameter mentioned (says user @line-o in the e-editiones slack channel).

It seems that per default the gregorian calendar is applied when displaying the weekday together with a date. As the gregorian calender system was only installed in 1582 (in christian europe), all sources dating before this year use the julian calendar. As a consequence, the wrong weekday is displayed when a xml-source with <date @when="1475-07-18"/> for example is processed.

Please make sure that different calendars can be applied and processed.

duncdrum commented 3 years ago

somewhat related see #3477

dizzzz commented 3 years ago

@claudia-sutter please could you share some code or even better a test case? (as suggested in the GitHub issue template), see http://www.exist-db.org/exist/apps/doc/xqsuite ; a test is essential as it is not common knowledge how to handle these dates.

for me this report is not yet usable, it requires too much time to investigate, outcome is not clear.

xpath https://www.w3.org/TR/xpath-functions-3/#rules-for-datetime-formatting

this issue is in essence a feature request.

dizzzz commented 3 years ago

@claudia-sutter please be more specific which calendar you need. "all" is not specific not realistic. from the spec:

Designator Calendar
AD Anno Domini (Christian Era)
AH Anno Hegirae (Muhammedan Era)
AME Mauludi Era (solar years since Mohammed's birth)
AM Anno Mundi (Jewish Calendar)
AP Anno Persici
AS Aji Saka Era (Java)
BE Buddhist Era
CB Cooch Behar Era
CE Common Era
CL Chinese Lunar Era
CS Chula Sakarat Era
EE Ethiopian Era
FE Fasli Era
ISO ISO 8601 calendar
JE Japanese Calendar
KE Khalsa Era (Sikh calendar)
KY Kali Yuga
ME Malabar Era
MS Monarchic Solar Era
NS Nepal Samwat Era
OS Old Style (Julian Calendar)
RS Rattanakosin (Bangkok) Era
SE Saka Era
SH Mohammedan Solar Era (Iran)
SS Saka Samvat
TE Tripurabda Era
VE Vikrama Era
VS Vikrama Samvat Era
claudia-sutter commented 3 years ago

@dizzzz I'm sorry if this issue comes in the wrong place. I was directly directed to this place here.

As mentioned, I'm speaking about the Julian Calender, in this list called OS (Old Style).

line-o commented 3 years ago

I can help in putting up a test case.

@claudia-sutter you shared a code example with me. Can you include it in your description?

xs:date("1475-07-18")
=> format-date("[FNn] [D]. [MNn] [Y]", "de", "OS", ())

This gives the weekday in the gregorian calender, which is sunday. But the right weekday is tuesday.

dizzzz commented 3 years ago

@claudia-sutter thnx for clarifying, the julian calendar was not mentioned in the original posting I see in the history. Maybe we crossed adding details. The location is good, we can track the issue here nicely.

dizzzz commented 3 years ago

Interestingly the code completely ignores the calendar parameter; I estimate the suggested change... is a big one. Does saxon actually support it? result is [Calendar: AD][Language: en]Sunday 18. July 1475. code here

claudia-sutter commented 3 years ago

@dizzzz This is exactly what I was told (that the calender is not mentioned in the code) before I was invited here. I guess this is the reason I was sent here. As I am only using code and not writing it, I don't know what to do next.

dizzzz commented 3 years ago

we'd need to investigate the request, and hopefully we can implement it.