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

(Decline to?) define a partial ordering for Timestamp

Open zslayton opened this issue 4 years ago • 1 comments

ion-schema's valid_values constraint (currently being implemented in amzn/ion-schema-kotlin#163) allows users to specify a range of acceptable timestamps. However, it is unclear how any given timestamp can be determined to be in that range. (More fundamentally, it is not always clear whether the provided min bound is less than the provided max bound.)

When comparing two timestamps for equality, they must have:

  • The same precision.
  • The same timezone offset (including unknown). Adjusting one timestamp to compare across offsets is not allowed.

It's unclear how precision and offset should come into play for ordering. 1992T is ostensibly before 2007-06T, but they're different precisions. Is this comparison allowed? What about 1992T vs 1992-06T? Perhaps when sorting them, higher precisions come later?

A partial ordering over timestamp seems possible. We should either prescribe a definition or explicitly decline to do so, allowing users like ion-schema to define their own.

zslayton avatar Feb 19 '21 20:02 zslayton

This has been explained by https://github.com/amzn/ion-schema/pull/34 based on decimal ordering.

desaikd avatar Jul 02 '21 23:07 desaikd