Something went wrong. Try again.
temp dir to hold datetime
Something went wrong. Try again.
1.6 kB · 83 lines
Zig
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384const 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());}