fix datetime-local input type

This commit is contained in:
Karl Seguin
2026-01-07 07:39:42 +08:00
parent c9d0e2097d
commit 6864a22721

View File

@@ -46,14 +46,16 @@ pub const Type = enum {
range, range,
date, date,
time, time,
datetime_local, @"datetime-local",
month, month,
week, week,
color, color,
pub fn fromString(str: []const u8) Type { pub fn fromString(str: []const u8) Type {
// Longest type name is "datetime-local" at 14 chars // Longest type name is "datetime-local" at 14 chars
if (str.len > 32) return .text; if (str.len > 32) {
return .text;
}
var buf: [32]u8 = undefined; var buf: [32]u8 = undefined;
const lower = std.ascii.lowerString(&buf, str); const lower = std.ascii.lowerString(&buf, str);
@@ -61,10 +63,7 @@ pub const Type = enum {
} }
pub fn toString(self: Type) []const u8 { pub fn toString(self: Type) []const u8 {
return switch (self) { return @tagName(self);
.datetime_local => "datetime-local",
else => @tagName(self),
};
} }
}; };