authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-09 02:48:20 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-09 02:48:20 -07:00
logd9600adbebfca90a8e795f1c072e9e681fa86d81
tree38639a59545fa6c396190b9ec7c56733a721b84d
parent04a75bd1e387fac71c302cf19147b42e78c6e197

fill out shorthand formats


2 files changed, 31 insertions(+), 10 deletions(-)

main.zig+20
......@@ -125,6 +125,26 @@ comptime {
125125
126126 .{ "x", "1144509852789" },
127127 .{ "X", "1144509852" },
128
129 .{ time.format.LT, "3:24 PM" },
130
131 .{ time.format.LTS, "3:24:12 PM" },
132
133 .{ time.format.L, "04/08/2006" },
134
135 .{ time.format.l, "4/8/2006" },
136
137 .{ time.format.LL, "April 8, 2006" },
138
139 .{ time.format.ll, "Apr 8, 2006" },
140
141 .{ time.format.LLL, "April 8, 2006 3:24 PM" },
142
143 .{ time.format.lll, "Apr 8, 2006 3:24 PM" },
144
145 .{ time.format.LLLL, "Saturday, April 8, 2006 3:24 PM" },
146
147 .{ time.format.llll, "Sat, Apr 8, 2006 3:24 PM" },
128148 });
129149
130150 // https://github.com/nektro/zig-time/issues/3
time.zig+11-10
......@@ -311,6 +311,7 @@ pub const DateTime = struct {
311311 '.',
312312 'T',
313313 'W',
314 '/',
314315 => {
315316 try writer.writeAll(&.{c});
316317 s = i + 1;
......@@ -403,16 +404,16 @@ pub const DateTime = struct {
403404};
404405
405406pub const format = struct {
406 pub const LT = "";
407 pub const LTS = "";
408 pub const L = "";
409 pub const l = "";
410 pub const LL = "";
411 pub const ll = "";
412 pub const LLL = "";
413 pub const lll = "";
414 pub const LLLL = "";
415 pub const llll = "";
407 pub const LT = "h:mm A";
408 pub const LTS = "h:mm:ss A";
409 pub const L = "MM/DD/YYYY";
410 pub const l = "M/D/YYY";
411 pub const LL = "MMMM D, YYYY";
412 pub const ll = "MMM D, YYY";
413 pub const LLL = LL ++ " " ++ LT;
414 pub const lll = ll ++ " " ++ LT;
415 pub const LLLL = "dddd, " ++ LLL;
416 pub const llll = "ddd, " ++ lll;
416417};
417418
418419pub const TimeZone = enum {