Merge pull request #3623 from yay/allow-space-in-rfc-3339

Allow space (in addition to T and t) as RFC 3339 date/time separator.
This commit is contained in:
Jeroen van Rijn
2024-05-24 19:10:04 +02:00
committed by GitHub
2 changed files with 8 additions and 6 deletions
+6 -6
View File
@@ -57,12 +57,12 @@ _rfc3339_to_components :: proc(rfc_datetime: string) -> (res: dt.DateTime, utc_o
(len(rfc_datetime) >= 20) or_return
// Scan and eat YYYY-MM-DD[Tt], then scan and eat HH:MM:SS, leave separator
year := scan_digits(rfc_datetime[0:], "-", 4) or_return
month := scan_digits(rfc_datetime[5:], "-", 2) or_return
day := scan_digits(rfc_datetime[8:], "Tt", 2) or_return
hour := scan_digits(rfc_datetime[11:], ":", 2) or_return
minute := scan_digits(rfc_datetime[14:], ":", 2) or_return
second := scan_digits(rfc_datetime[17:], "", 2) or_return
year := scan_digits(rfc_datetime[0:], "-", 4) or_return
month := scan_digits(rfc_datetime[5:], "-", 2) or_return
day := scan_digits(rfc_datetime[8:], "Tt ", 2) or_return
hour := scan_digits(rfc_datetime[11:], ":", 2) or_return
minute := scan_digits(rfc_datetime[14:], ":", 2) or_return
second := scan_digits(rfc_datetime[17:], "", 2) or_return
nanos := 0
count := 19