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 {
404404
405405pub const TimeZone = enum {
406406 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 }
407412};
408413
409414pub const WeekDay = enum {
......@@ -426,11 +431,21 @@ pub const WeekDay = enum {
426431 .Sat => .Sun,
427432 };
428433 }
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 }
429439};
430440
431441pub const Era = enum {
432442 // BC,
433443 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 }
434449};
435450
436451pub fn isLeapYear(year: u16) bool {