authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-11 01:59:48 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-11 01:59:48 -08:00
log2527d016432cb34e042bedd3530b480c5a8a1c74
tree38f2a9c0847788971a13b2c5333c04e569b0ff42
parentd36cf720d305ffcf3003d855feeb00a10913bc56

add jsonStringify methods to the enums


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

time.zig+15
...@@ -404,6 +404,11 @@ pub const format = struct {...@@ -404,6 +404,11 @@ pub const format = struct {
404404
405pub const TimeZone = enum {405pub const TimeZone = enum {
406 UTC,406 UTC,
407
408 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
409 _ = options;
410 try out_stream.writeAll(@tagName(self));
411 }
407};412};
408413
409pub const WeekDay = enum {414pub const WeekDay = enum {
...@@ -426,11 +431,21 @@ pub const WeekDay = enum {...@@ -426,11 +431,21 @@ pub const WeekDay = enum {
426 .Sat => .Sun,431 .Sat => .Sun,
427 };432 };
428 }433 }
434
435 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
436 _ = options;
437 try out_stream.writeAll(@tagName(self));
438 }
429};439};
430440
431pub const Era = enum {441pub const Era = enum {
432 // BC,442 // BC,
433 AD,443 AD,
444
445 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
446 _ = options;
447 try out_stream.writeAll(@tagName(self));
448 }
434};449};
435450
436pub fn isLeapYear(year: u16) bool {451pub fn isLeapYear(year: u16) bool {