diff --git a/README.md b/README.md index f5bfff5d6e0303b972cf138e683b1a0c9e05a8c8..bafeed3837a68b8d70fd0c840e8f6f72df515e37 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![loc](https://sloc.xyz/github/nektro/zig-time) [![license](https://img.shields.io/github/license/nektro/zig-time.svg)](https://github.com/nektro/zig-time/blob/master/LICENSE) [![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro) -[![Zig](https://img.shields.io/badge/Zig-0.15-f7a41d)](https://ziglang.org/) +[![Zig](https://img.shields.io/badge/Zig-0.16-f7a41d)](https://ziglang.org/) [![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod) Exposes a `DateTime` structure that can be initialized and acted upon using various methods. All public methods return a new structure. diff --git a/time.zig b/time.zig index 7cfab48ecc5b12cb9a9eaa53b921eff0f4c6e6e9..e5f27db522dce1e991eb688b5b7dc9066e65d35d 100644 --- a/time.zig +++ b/time.zig @@ -250,9 +250,7 @@ pub const DateTime = struct { } /// fmt is based on https://momentjs.com/docs/#/displaying/format/ - pub fn format(self: DateTime, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) !void { - _ = options; - + pub fn formatFmt(self: DateTime, comptime fmt: string, writer: anytype) !void { if (fmt.len == 0) @compileError("DateTime: format string can't be empty"); @setEvalBranchQuota(100000); @@ -358,10 +356,10 @@ pub const DateTime = struct { } pub fn formatAlloc(self: DateTime, alloc: std.mem.Allocator, comptime fmt: string) !string { - var list = std.array_list.Managed(u8).init(alloc); + var list = std.Io.Writer.Allocating.init(alloc); defer list.deinit(); - try self.format(fmt, .{}, list.writer()); + try self.formatFmt(fmt, &list.writer); return list.toOwnedSlice(); }