w3c / wot-profile

Web of Things (WoT) Profile
http://w3c.github.io/wot-profile/
Other
16 stars 8 forks source link

Consolidate date-time references to RFC 3339 - closes #276 #287

Closed benfrancis closed 1 year ago

benfrancis commented 2 years ago

This PR addresses issue #276. It fixes inconsistent and broken references and changes all date-time constraints within the specification to refer to the Date Time section, which itself references RFC 3339.

I have changed the clarifying assertions in the Date Time section into a Note since they only repeat what it says in RFC 3339.

Apart from making the date format consistent throughout the specification, the only significant normative change is that timezones are allowed in timestamps, but only by way of unambiguous numerical UTC offsets as allowed by RFC 3339. This still helps remove ambiguity, but fixes the awkward situation where some RFC 3339 timestamps are valid and others are not, which should help simplify implementation.


Preview | Diff

benfrancis commented 2 years ago

Currently the specification has a mix of references to xmlschema-2, ISO8601-1 and RFC3339.

This PR is intended to consolidate them around a single format for consistency.

As I understand it RFC 3339 is a "profile" of the ISO 8601 standard which adds additional constraints to remove ambiguities (such as not allowing 24 as an hour), which seems appropriate here.

Note that the Thing Description specification says that:

Values that are of type dateTime MUST be serialized as JSON strings following the "date-time" format specified by [RFC3339]

Given that some timestamps which are valid ISO 8601 are not valid under RFC 3339, referencing ISO 8601 is not really enough.

This is a notoriously complicated area and it's also true that there are some timestamps which would be valid under RFC 3339 but not valid under ISO 8601. There's a useful comparison here and visualisation here. As I understand it most programming languages only support a simplified subset of ISO 8601. For example, ECMA262 specifies a simplified version of ISO 8601 which can be parsed by JavaScript, so allowing any ISO 8601 timestamp also unfortunately does not guarantee interoperability.

My suggestion is just to refer to an existing standard rather than invent our own (by adding additional normative assertions on top), and being consistent with the Thing Description specification seems like a good idea.

mlagally commented 1 year ago

Arch call on Nov 10th: Agree to merge