upgrade date.zig

This commit is contained in:
Emil Lerch 2023-08-04 16:38:19 -07:00
parent c2dc55c8ff
commit 9f5c380b66
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -73,7 +73,6 @@ pub fn parseEnglishToDateTime(data: []const u8) !DateTime {
// Anything not explicitly set by our string would be 0 // Anything not explicitly set by our string would be 0
var rc = DateTime{ .year = 0, .month = 0, .day = 0, .hour = 0, .minute = 0, .second = 0 }; var rc = DateTime{ .year = 0, .month = 0, .day = 0, .hour = 0, .minute = 0, .second = 0 };
for (data, 0..) |ch, i| { for (data, 0..) |ch, i| {
_ = i;
switch (ch) { switch (ch) {
',' => {}, ',' => {},
' ', ':' => { ' ', ':' => {
@ -155,7 +154,6 @@ pub fn parseIso8601ToDateTime(data: []const u8) !DateTime {
var rc = DateTime{ .year = 0, .month = 0, .day = 0, .hour = 0, .minute = 0, .second = 0 }; var rc = DateTime{ .year = 0, .month = 0, .day = 0, .hour = 0, .minute = 0, .second = 0 };
var zulu_time = false; var zulu_time = false;
for (data, 0..) |ch, i| { for (data, 0..) |ch, i| {
_ = i;
switch (ch) { switch (ch) {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' => { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' => {
if (state == .Start) state = .Year; if (state == .Start) state = .Year;