Add 12-hour format (hh) and AM/PM (a) tokens to time formatter

This commit is contained in:
Richard Zink committed 2026-10-07 13:07:34 +02:00
1 parent c2996e4762
commit dc41cabe4d
1 file changed
+8
+8
View File
@@ -832,6 +832,14 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
} else if (ch === 'H' && format.substr(i, 2) === 'HH') { } else if (ch === 'H' && format.substr(i, 2) === 'HH') {
result += pad2(date.getHours()); result += pad2(date.getHours());
i += 2; i += 2;
} else if (ch === 'h' && format.substr(i, 2) === 'hh') {
var h12 = date.getHours() % 12;
if (h12 === 0) h12 = 12;
result += pad2(h12);
i += 2;
} else if (ch === 'a') {
result += date.getHours() < 12 ? 'AM' : 'PM';
i += 1;
} else if (ch === 'm' && format.substr(i, 2) === 'mm') { } else if (ch === 'm' && format.substr(i, 2) === 'mm') {
result += pad2(date.getMinutes()); result += pad2(date.getMinutes());
i += 2; i += 2;