authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-24 04:27:17 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-24 04:27:17 -07:00
log4048e8b17ade544b6afc4c85a0503ab7e2e068f4
treed142e5b3a0a0887384997e1e70c93c99c51721d4
parentb62a4341424d566e5c025ed41e796418dee53a89

add the era property


1 files changed, 7 insertions(+), 0 deletions(-)

time.zig+7
...@@ -12,6 +12,7 @@ pub const DateTime = struct {...@@ -12,6 +12,7 @@ pub const DateTime = struct {
12 years: u16,12 years: u16,
13 timezone: TimeZone,13 timezone: TimeZone,
14 weekday: WeekDay,14 weekday: WeekDay,
15 era: Era,
1516
16 const Self = @This();17 const Self = @This();
1718
...@@ -48,6 +49,7 @@ pub const DateTime = struct {...@@ -48,6 +49,7 @@ pub const DateTime = struct {
48 .years = 1970,49 .years = 1970,
49 .timezone = .UTC,50 .timezone = .UTC,
50 .weekday = .Thu,51 .weekday = .Thu,
52 .era = .AD,
51 };53 };
5254
53 pub fn eql(self: Self, other: Self) bool {55 pub fn eql(self: Self, other: Self) bool {
...@@ -378,6 +380,11 @@ pub const WeekDay = enum {...@@ -378,6 +380,11 @@ pub const WeekDay = enum {
378 }380 }
379};381};
380382
383pub const Era = enum {
384 // BC,
385 AD,
386};
387
381fn printOrdinal(writer: anytype, num: u16) !void {388fn printOrdinal(writer: anytype, num: u16) !void {
382 try writer.print("{}", .{num});389 try writer.print("{}", .{num});
383 try writer.writeAll(switch (num) {390 try writer.writeAll(switch (num) {