diff --git a/src/date.zig b/src/date.zig index 479a809..b581456 100644 --- a/src/date.zig +++ b/src/date.zig @@ -57,6 +57,10 @@ pub fn timestampToDateTime(timestamp: i64) DateTime { return DateTime{ .day = day, .month = month, .year = year, .hour = hours, .minute = minutes, .second = seconds }; } +pub fn parseIso8601ToTimestamp(data: []const u8) !i64 { + return try dateTimeToTimestamp(try parseIso8601ToDateTime(data)); +} + const IsoParsingState = enum { Start, Year, Month, Day, Hour, Minute, Second, Millisecond, End }; /// Converts a string to a timestamp value. May not handle dates before the /// epoch