Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fo31] Incorrect picture string for RFC 1123 / IETF-style date #36

Open
joewiz opened this issue Jan 21, 2022 · 0 comments
Open

[fo31] Incorrect picture string for RFC 1123 / IETF-style date #36

joewiz opened this issue Jan 21, 2022 · 0 comments

Comments

@joewiz
Copy link

joewiz commented Jan 21, 2022

In https://www.w3.org/TR/xpath-functions-31/#func-parse-ietf-date, a note contains a picture string which should produce an RFC 1123 / IETF-style date:

An RFC 1123 date can be generated approximately using fn:format-dateTime with a picture string of "[FNn3], [D01] [MNn3] [Y04] [H01]:[m01]:[s01] [Z0000]".

Given a dateTime like 1994-06-06T07:29:35Z, applying fn:format-dateTime with this picture string should return:

Mon, 06 Jun 1994 07:29:35 +0000

But according to the documentation on the picture string at https://www.w3.org/TR/xpath-functions-31/#date-picture-string, to truncate the day of the week and the month to 3 letters, we should not append 3 but *,-3, and to ensure a 4-digit year, we should use Y0001 instead of Y04. In other words, the picture string should be:

"[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z0000]")

… instead of:

"[FNn3], [D01] [MNn3] [Y04] [H01]:[m01]:[s01] [Z0000]"

My testing in BaseX, eXist, and Saxon shows that the picture string from the spec fails to produce the expected output, whereas the modified picture string produces the expected output:

Mon, 06 Jun 1994 07:29:35 +0000

The test expression that produces this expected output:

format-dateTime(xs:dateTime("1994-06-06T07:29:35Z"), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z0000]")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@joewiz and others