ion-docs icon indicating copy to clipboard operation
ion-docs copied to clipboard

Spec: negative year in binary encoding

Open 9il opened this issue 4 years ago • 2 comments

I didn't find a way to report a spec issue.

It is very weird binary ion timestamp can't be used to represent a time B.C. Can this be fixed in this or maybe the next Ion version?

9il avatar Jan 29 '21 07:01 9il

I didn't find a way to report a spec issue.

We track these in the ion-docs repo, where the spec is documented. I've transferred the issue.

It is very weird binary ion timestamp can't be used to represent a time B.C.

I believe this is to guarantee that timestamps written in text and binary are capable of representing the same ranges of data. Text Ion timestamps adhere to ISO8601, which itself only supports years 0000 to 9999. Support for years outside that range requires non-standard modifications to the YYYY format that readers and writers must agree upon ahead of time.

Could you describe your use case a bit?

zslayton avatar Jan 29 '21 13:01 zslayton

We track these in the ion-docs repo, where the spec is documented. I've transferred the issue.

Thanks

Could you describe your use case a bit?

I am working on JSON/Ion serialization library for D and was confused by the difference with other D date APIs that allow negative years. My use case doesn't require this extension. Ion is the most powerful format. This extension would make it even greater for some scientific cases.

I believe this is to guarantee that timestamps written in text and binary are capable of representing the same ranges of data. Text Ion timestamps adhere to ISO8601, which itself only supports years 0000 to 9999. Support for years outside that range requires non-standard modifications to the YYYY format that readers and writers must agree upon ahead of time.

I can't find a free version ISO 8601 2004 (or newer). According to Wikipedia, the standard permits the extension:

By mutual agreement of the partners in information interchange, it is permitted to expand the component identifying the calendar year, which is otherwise limited to four digits. This enables reference to dates and times in calendar years outside the range supported by complete representations, i.e. before the start of the year [0000] or after the end of the year [9999]

9il avatar Jan 29 '21 17:01 9il