const std = @import("std"); const utils = @import("utils.zig"); pub const DateTime = @import("DateTime.zig"); pub const Date = @import("Date.zig"); pub const Time = @import("Time.zig"); pub const Zone = @import("Zone.zig"); pub const Weekday = enum(u3) { sunday = 0, monday, tuesday, wednesday, thursday, friday, saturday, pub fn name(self: Weekday) []const u8 { return utils.titleCase(Weekday, self); } pub fn short(self: Weekday) []const u8 { return self.name()[0..3]; } }; pub const Month = enum(u4) { january = 1, february = 2, march = 3, april = 4, may = 5, june = 6, july = 7, august = 8, september = 9, october = 10, november = 11, december = 12, /// Convert int to Month, months are 1 indexed. /// invalid options will set month to .invalid. pub fn fromInt(int: u8) error{InvalidMonth}!Month { if (int < 1 or int > 12) return error.InvalidMonth; return @enumFromInt(int); } pub fn name(self: Month) []const u8 { return utils.titleCase(Month, self); } pub fn short(self: Month) []const u8 { return self.name()[0..3]; } }; pub const Format = enum { iso8601, rfc3339, }; pub const Error = error{ InvalidDate, InvalidMonth, InvalidTime, InvalidDateTime, InvalidCharacter, UnexpectedToken, OutsideJulianPeriod, NonUTCNotSupported, NotImplemented, }; pub const Precision = enum { seconds, milliseconds, microseconds, nanoseconds, }; test { std.testing.refAllDecls(@This()); }