Browse Source

Allow lowercase z TZ indicator.

Jeroen van Rijn 1 year ago
parent
commit
e1c4b9b06a
2 changed files with 3 additions and 1 deletions
  1. 1 1
      core/time/rfc3339.odin
  2. 2 0
      tests/core/time/test_core_time.odin

+ 1 - 1
core/time/rfc3339.odin

@@ -87,7 +87,7 @@ _rfc3339_to_components :: proc(rfc_datetime: string) -> (res: dt.DateTime, utc_o
 
 
 	// Scan UTC offset
 	// Scan UTC offset
 	switch rfc_datetime[count] {
 	switch rfc_datetime[count] {
-	case 'Z':
+	case 'Z', 'z':
 		utc_offset = 0
 		utc_offset = 0
 		count += 1
 		count += 1
 	case '+', '-':
 	case '+', '-':

+ 2 - 0
tests/core/time/test_core_time.odin

@@ -94,6 +94,8 @@ rfc3339_tests :: []RFC3339_Test{
 	{"1985-04-12T23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
 	{"1985-04-12T23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
 	{"1985-04-12t23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
 	{"1985-04-12t23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
 	{"1985-04-12 23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
 	{"1985-04-12 23:20:50.52Z",      {482196050520000000},  true,  0,    23, false},
+	// Same, but lowercase z
+	{"1985-04-12 23:20:50.52z",      {482196050520000000},  true,  0,    23, false},
 
 
 	// This represents 39 minutes and 57 seconds after the 16th hour of December 19th, 1996 with an offset of -08:00 from UTC (Pacific Standard Time).
 	// This represents 39 minutes and 57 seconds after the 16th hour of December 19th, 1996 with an offset of -08:00 from UTC (Pacific Standard Time).
 	// Note that this is equivalent to 1996-12-20T00:39:57Z in UTC.
 	// Note that this is equivalent to 1996-12-20T00:39:57Z in UTC.