diff --git a/time.zig b/time.zig index deecc947902167e45779bc15c8b70b4188918b67..2c07338a2ff6aabba9a87d5734f8c9f96bb7d07c 100644 --- a/time.zig +++ b/time.zig @@ -13,7 +13,6 @@ pub const DateTime = struct { years: u16, timezone: TimeZone, weekday: WeekDay, - era: Era, const Self = @This(); @@ -50,7 +49,6 @@ pub const DateTime = struct { .years = 1970, .timezone = .UTC, .weekday = .Thu, - .era = .AD, }; pub fn eql(self: Self, other: Self) bool { @@ -271,7 +269,7 @@ pub const DateTime = struct { .YYY => try writer.print("{}", .{self.years}), .YYYY => try writer.print("{:0>4}", .{self.years}), - .N => try writer.writeAll(@tagName(self.era)), + .N => try writer.writeAll(@tagName(self.era())), .NN => try writer.writeAll("Anno Domini"), .A => try printLongName(writer, self.hours / 12, &[_]string{ "AM", "PM" }), @@ -388,6 +386,11 @@ pub const DateTime = struct { .ms = self.toUnixMilli() - other_in_the_past.toUnixMilli(), }; } + + pub fn era(self: Self) Era { + if (self.years >= 0) return .AD; + @compileError("TODO"); + } }; pub const format = struct {