authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-27 15:48:38 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-27 15:48:38 -08:00
loga22054de725ef19b3f91b9ad960d4093f852b7e0
tree301a4233a4d2e190469f6da85af7d5129e91dd79
parent2527d016432cb34e042bedd3530b480c5a8a1c74

fix jsonStringify support in the enums


2 files changed, 5 insertions(+), 12 deletions(-)

time.zig+4-12
......@@ -1,6 +1,7 @@
11const std = @import("std");
22const string = []const u8;
33const range = @import("range").range;
4const extras = @import("extras");
45const time = @This();
56
67pub const DateTime = struct {
......@@ -405,10 +406,7 @@ pub const format = struct {
405406pub const TimeZone = enum {
406407 UTC,
407408
408 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
409 _ = options;
410 try out_stream.writeAll(@tagName(self));
411 }
409 usingnamespace extras.TagNameJsonStringifyMixin(@This());
412410};
413411
414412pub const WeekDay = enum {
......@@ -432,20 +430,14 @@ pub const WeekDay = enum {
432430 };
433431 }
434432
435 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
436 _ = options;
437 try out_stream.writeAll(@tagName(self));
438 }
433 usingnamespace extras.TagNameJsonStringifyMixin(@This());
439434};
440435
441436pub const Era = enum {
442437 // BC,
443438 AD,
444439
445 pub fn jsonStringify(self: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
446 _ = options;
447 try out_stream.writeAll(@tagName(self));
448 }
440 usingnamespace extras.TagNameJsonStringifyMixin(@This());
449441};
450442
451443pub fn isLeapYear(year: u16) bool {
zig.mod+1
......@@ -5,3 +5,4 @@ license: MIT
55description: A date and time parsing and formatting library for Zig.
66dependencies:
77 - src: git https://github.com/nektro/zig-range
8 - src: git https://github.com/nektro/zig-extras