Skip to content

Commit a0f94af

Browse files
committed
enh: Accept UTC offsets in datetimes
1 parent 46d2399 commit a0f94af

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
@@ -1009,16 +1009,15 @@ For additional rules, see below:
10091009
Describing dates and timestamps:
10101010

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

10231022
- Time stamp information MUST be expressed in the following format:
10241023
`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)