Skip to content

Commit 7e8a748

Browse files
authored
Make seconds optional in Date-Time and Time (#894)
1 parent 61ad52a commit 7e8a748

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Clarify where and how dotted keys define tables.
88
* Add new `\e` shorthand for the escape character.
99
* Add \x00 notation to basic strings.
10+
* Seconds in Date-Time and Time values are now optional.
1011

1112
## 1.0.0 / 2021-01-11
1213

toml.abnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ time-secfrac = "." 1*DIGIT
176176
time-numoffset = ( "+" / "-" ) time-hour ":" time-minute
177177
time-offset = "Z" / time-numoffset
178178

179-
partial-time = time-hour ":" time-minute ":" time-second [ time-secfrac ]
179+
partial-time = time-hour ":" time-minute [ ":" time-second [ time-secfrac ] ]
180180
full-date = date-fullyear "-" date-month "-" date-mday
181181
full-time = partial-time time-offset
182182

toml.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,14 @@ time with a space character (as permitted by RFC 3339 section 5.6).
554554
odt4 = 1979-05-27 07:32:00Z
555555
```
556556

557+
One exception to RFC 3339 is permitted: seconds may be omitted, in which case
558+
`:00` will be assumed. The offset immediately follows the minutes.
559+
560+
```toml
561+
odt5 = 1979-05-27 07:32Z
562+
odt6 = 1979-05-27 07:32-07:00
563+
```
564+
557565
Millisecond precision is required. Further precision of fractional seconds is
558566
implementation-specific. If the value contains greater precision than the
559567
implementation can support, the additional precision must be truncated, not
@@ -573,6 +581,12 @@ ldt1 = 1979-05-27T07:32:00
573581
ldt2 = 1979-05-27T00:32:00.999999
574582
```
575583

584+
Seconds may be omitted, in which case `:00` will be assumed.
585+
586+
```toml
587+
ldt3 = 1979-05-27T07:32
588+
```
589+
576590
Millisecond precision is required. Further precision of fractional seconds is
577591
implementation-specific. If the value contains greater precision than the
578592
implementation can support, the additional precision must be truncated, not
@@ -602,6 +616,12 @@ lt1 = 07:32:00
602616
lt2 = 00:32:00.999999
603617
```
604618

619+
Seconds may be omitted, in which case `:00` will be assumed.
620+
621+
```toml
622+
lt3 = 07:32
623+
```
624+
605625
Millisecond precision is required. Further precision of fractional seconds is
606626
implementation-specific. If the value contains greater precision than the
607627
implementation can support, the additional precision must be truncated, not

0 commit comments

Comments
 (0)