Skip to content

Reconsider usage of xsd:date #945

@siuc-nate

Description

@siuc-nate

We have current use cases that require support for partial dates, e.g. 2024-08 and/or 2024, which I thought were supported by xsd:date, but actually are not (ISO8601, which xsd:date is based on, supports them, but not xsd:date itself).
https://www.w3.org/TR/xmlschema-2/#date
https://www.w3.org/TR/xmlschema-2/#isoformats
https://www.w3.org/TR/xmlschema-2/#truncatedformats

Right truncated formats are also, in general, not permitted for the datatypes defined in this specification with the following exceptions: right-truncated representations of dateTime are used as lexical representations for date, gMonth, gYear.

I can see two potential solutions:

  • Replace our usage of xsd:date with schema:Date (which uses ISO8601 directly and thus allows the year and year-month formats, but also allows other things we don't necessarily want to account for), or
  • Update the ranges of properties that currently use xsd:date to also include xsd:gYearMonth and xsd:gYear (which have stricter rules, but may be closer to what we want)

The second option is probably the safer of the two, as it avoids opening the door to other variations/truncations ISO8601 allows. That would also give us the flexibility to allow/deny, for example, YYYY-MM-DD and YYYY-MM formats but not YYYY formats for some properties (if we ever wanted to do that).

We only need to update the properties where we specifically want to allow partial dates, but if we were to update all properties with a range of xsd:date, the list would be:

Note: I can't think of a case where we need to worry about partial xsd:dateTimes, so we're probably okay with those properties as-is, but they're worth considering, too.

Metadata

Metadata

Projects

Status

Formal Proposal Ready

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions