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

Datetime data type missing timezone and precision #498

Closed
msporny opened this issue Dec 14, 2020 · 4 comments · Fixed by #509
Closed

Datetime data type missing timezone and precision #498

msporny opened this issue Dec 14, 2020 · 4 comments · Fixed by #509
Assignees
Labels
pr exists There is an open PR to address this issue

Comments

@msporny
Copy link
Member

msporny commented Dec 14, 2020

The current datetime data type in the specification does not mention timezone or second vs. millisecond precision. This is important for representations to specify. We need a PR to address these shortcomings in the current data model.

@shigeya
Copy link
Contributor

shigeya commented Dec 16, 2020

The current specification states that all three representations (JSON, JSON-LD, and CBOR) treat datetime data type as a string.

I propose the following logic: If the parser keeps a deserialized datetime typed string as-is internally and uses the string for serialization, there will be no loss, no issues from a digital signing point of view. If some internal logic next to the abstract data model wants to parse the string, it can parse just for internal logic purposes.

I checked the XML schema spec to be sure.
In XMLdateTime the second fragment is expressed as the following regexp:

[61] secondFrag ::= ([0-5] digit) ('.' digit+)?

Thus, (of course) it is also valid from a lexical representation point of view.

@msporny
Copy link
Member Author

msporny commented Dec 17, 2020

The current specification states that all three representations (JSON, JSON-LD, and CBOR) treat datetime data type as a string.

CBOR-LD does not do this, and instead stores the value as seconds since the Unix epoch (if it can), or a string otherwise.

I'm having a hard time understanding how to translate your proposal into spec text -- @shigeya, could you please provide concrete specification text we could discuss? That might be easier to discuss.

@shigeya
Copy link
Contributor

shigeya commented Dec 17, 2020

CBOR-LD does not do this, and instead stores the value as seconds since the Unix epoch (if it can), or a string otherwise.

Okay, now I understand the actual pain point.

I think the spec may have a reasonable constraint to the datetime data type string to avoid the issue. Staying with a similar spec as CBOR-LD seems reasonable, at this moment.

I'm having a hard time understanding how to translate your proposal into spec text -- @shigeya, could you please provide concrete specification text we could discuss? That might be easier to discuss.

I see. I will write an actual spec text after I understand the issue with timezone in a similar way.

@msporny msporny added pr exists There is an open PR to address this issue and removed ready for pr Issue is ready for a PR labels Dec 20, 2020
@msporny
Copy link
Member Author

msporny commented Dec 20, 2020

This issue will be closed once PR #509 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr exists There is an open PR to address this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants