Skip to content

Commit 0e0ae07

Browse files
committed
enh: Accept UTC offsets in datetimes
1 parent c453524 commit 0e0ae07

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

src/common-principles.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,16 +1014,15 @@ For additional rules, see below:
10141014
Describing dates and timestamps:
10151015

10161016
- Date time information MUST be expressed in the following format
1017-
`YYYY-MM-DDThh:mm:ss[.000000][Z]` (year, month, day, hour (24h), minute,
1018-
second, optional fractional seconds, and optional UTC time indicator).
1017+
`YYYY-MM-DDThh:mm:ss[.000000][Z|+hh:mm|-hh:mm]` (year, month, day, hour (24h),
1018+
minute, second, optional fractional seconds, and optional time offset).
10191019
This is almost equivalent to the [RFC3339](https://tools.ietf.org/html/rfc3339)
1020-
"date-time" format, with the exception that UTC indicator `Z` is optional and
1021-
non-zero UTC offsets are not indicated.
1022-
If `Z` is not indicated, time zone is always assumed to be the local time of the
1023-
dataset viewer.
1020+
"date-time" format, with the exception that UTC offsets are OPTIONAL.
1021+
If no time offset is indicated,
1022+
time zone is always assumed to be the local time of the dataset viewer.
10241023
No specific precision is required for fractional seconds, but the precision
10251024
SHOULD be consistent across the dataset.
1026-
For example `2009-06-15T13:45:30`.
1025+
For example `2009-06-15T13:45:30+01:00`.
10271026

10281027
- Time stamp information MUST be expressed in the following format:
10291028
`hh:mm:ss[.000000]`

src/schema/objects/formats.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,24 @@ date:
6969
datetime:
7070
display_name: Datetime
7171
description: |
72-
A datetime in the form `"YYYY-MM-DDThh:mm:ss[.000000][Z]"`,
73-
where [.000000] is an optional subsecond resolution between 1 and 6 decimal points,
74-
and [Z] is an optional, valid timezone code.
75-
pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,6})?([A-Z]{2,4})?'
72+
An [RFC 3339](https://doi.org/10.17487/RFC3339) timestamp, with OPTIONAL time offset.
73+
Datetimes take the form `"YYYY-MM-DDThh:mm:ss[.000000][Z|+hh:mm|-hh:mm]"`,
74+
where `[.000000]` is an OPTIONAL subsecond resolution between 1 and 6 decimal points,
75+
and `[Z|+hh:mm|-hh:mm]` is a time offset.
76+
The character `Z` indicates Coordinated Universal Time (UTC),
77+
or else an integral number of minutes may be specified.
78+
79+
For simplicity, this format validates RFC3339-invalid dates such as 2024-02-31,
80+
but implementations SHOULD error on non-existent dates and times.
81+
pattern: "\
82+
[0-9]{4}\
83+
-(?:0[1-9]|1[0-2])\
84+
-(?:0[1-9]|[12][0-9]|3[01])\
85+
T(?:2[0-3]|[01][0-9])\
86+
:[0-5][0-9]\
87+
:(?:[0-5][0-9]|60)\
88+
(?:\\.[0-9]{1,6})?\
89+
(?:Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?"
7690
file_relative:
7791
display_name: Path relative to the parent file
7892
description: |

0 commit comments

Comments
 (0)