| ... | ... | @@ -13,7 +13,6 @@ pub const DateTime = struct { |
| 13 | 13 | years: u16, |
| 14 | 14 | timezone: TimeZone, |
| 15 | 15 | weekday: WeekDay, |
| 16 | | era: Era, |
| 17 | 16 | |
| 18 | 17 | const Self = @This(); |
| 19 | 18 | |
| ... | ... | @@ -50,7 +49,6 @@ pub const DateTime = struct { |
| 50 | 49 | .years = 1970, |
| 51 | 50 | .timezone = .UTC, |
| 52 | 51 | .weekday = .Thu, |
| 53 | | .era = .AD, |
| 54 | 52 | }; |
| 55 | 53 | |
| 56 | 54 | pub fn eql(self: Self, other: Self) bool { |
| ... | ... | @@ -271,7 +269,7 @@ pub const DateTime = struct { |
| 271 | 269 | .YYY => try writer.print("{}", .{self.years}), |
| 272 | 270 | .YYYY => try writer.print("{:0>4}", .{self.years}), |
| 273 | 271 | |
| 274 | | .N => try writer.writeAll(@tagName(self.era)), |
| 272 | .N => try writer.writeAll(@tagName(self.era())), |
| 275 | 273 | .NN => try writer.writeAll("Anno Domini"), |
| 276 | 274 | |
| 277 | 275 | .A => try printLongName(writer, self.hours / 12, &[_]string{ "AM", "PM" }), |
| ... | ... | @@ -388,6 +386,11 @@ pub const DateTime = struct { |
| 388 | 386 | .ms = self.toUnixMilli() - other_in_the_past.toUnixMilli(), |
| 389 | 387 | }; |
| 390 | 388 | } |
| 389 | |
| 390 | pub fn era(self: Self) Era { |
| 391 | if (self.years >= 0) return .AD; |
| 392 | @compileError("TODO"); |
| 393 | } |
| 391 | 394 | }; |
| 392 | 395 | |
| 393 | 396 | pub const format = struct { |