Skip to content

Duration and timestamp types exceed range from language definition #151

@apasel422

Description

@apasel422

In the process of addressing the TODOs for handling timestamp/duration overflow, I noticed that this crate permits values that exceed that of the language definition

  • Duration values are limited to a single int64 value, or roughly +-290 years.
  • Timestamp values are limited to the range of values which can be serialized as a string: ["0001-01-01T00:00:00Z", "9999-12-31T23:59:59.999999999Z"].

In particular, the expression

timestamp('9999-12-31T23:59:59Z') + duration('1s')

evaluates to +10000-01-01T00:00:00+00:00 instead of causing an error, like the corresponding specification test.

I haven't checked other overflow cases yet, but I assume they also exist.

We should reconsider whether to directly expose chrono's types here, or whether it would be better to add wrappers, which might also be beneficial in case we ever wanted to migrate to another dependency. We could still, of course, provide conversions to and from chrono's types with the appropriate range checking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions