authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-24 04:29:51 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-24 04:29:51 -07:00
log4a8182b89c9cdc5d948f2dd87b396c4ddeb8ed75
tree423f1ad4c55aed93d040d3c61a0507b13b4f90c7
parent167f01c008b3b6f5563867c7be135bd1c3a7d4e9

add more year printers


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

main.zig+4
......@@ -45,3 +45,7 @@ test { try assertOk(1144509852789, "E", "7"); }
4545test { try assertOk(1144509852789, "w", "14"); }
4646test { try assertOk(1144509852789, "wo", "14th"); }
4747test { try assertOk(1144509852789, "ww", "14"); }
48test { try assertOk(1144509852789, "Y", "12006"); }
49test { try assertOk(1144509852789, "YY", "06"); }
50test { try assertOk(1144509852789, "YYY", "2006"); }
51test { try assertOk(1144509852789, "YYYY", "2006"); }
time.zig+3
......@@ -251,6 +251,9 @@ pub const DateTime = struct {
251251 .w => try writer.print("{}", .{self.dayOfThisYear() / 7 + 1}),
252252 .wo => try printOrdinal(writer, self.dayOfThisYear() / 7 + 1),
253253 .ww => try writer.print("{:0>2}", .{self.dayOfThisYear() / 7 + 1}),
254 .Y => try writer.print("{}", .{self.years + 10000}),
255 .YY => try writer.print("{:0>2}", .{self.years % 100}),
256 .YYY => try writer.print("{}", .{self.years}),
254257
255258 else => @compileError("'" ++ @tagName(tag) ++ "' not currently supported"),
256259 }