Skip to content

Commit 5d8bf61

Browse files
authored
Require ISO 8601 date or datetime literals (#687)
1 parent 61273c7 commit 5d8bf61

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

spec/registry.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -901,14 +901,19 @@ an implementation-defined date/time type
901901
or a _date/time literal value_, as defined below.
902902
All other _operand_ values produce an _Invalid Expression_ error.
903903
904-
A **_<dfn>date/time literal value</dfn>_** is a non-empty string consisting of
905-
one of the following:
906-
- an XMLSchema 1.1 [dateTime](https://www.w3.org/TR/xmlschema11-2/#dateTime)
907-
- an XMLSchema 1.1 [time](https://www.w3.org/TR/xmlschema11-2/#time)
908-
- an XMLSchema 1.1 [date](https://www.w3.org/TR/xmlschema11-2/#date)
909-
910-
The `timezoneOffset` of each of these formats is optional.
911-
When the offset is not present, implementations should use a floating time type
904+
A **_<dfn>date/time literal value</dfn>_** is a non-empty string consisting of an ISO 8601 date,
905+
or an ISO 8601 datetime optionally followed by a timezone offset.
906+
As implementations differ slightly in their parsing of such strings,
907+
ISO 8601 date and datetime values not matching the following regular expression MAY also be supported.
908+
Furthermore, matching this regular expression does not guarantee validity,
909+
given the variable number of days in each month.
910+
911+
```regexp
912+
(?!0000)[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,3})?(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?
913+
```
914+
915+
When the time is not present, implementations SHOULD use `00:00:00` as the time.
916+
When the offset is not present, implementations SHOULD use a floating time type
912917
(such as Java's `java.time.LocalDateTime`) to represent the time value.
913918
For more information, see [Working with Timezones](https://w3c.github.io/timezone).
914919

0 commit comments

Comments
 (0)