1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 20:20:30 +00:00

Correctly format 12AM/PM with %I

Fixes #1243
This commit is contained in:
Jonathan Coates 2022-12-06 21:50:28 +00:00
parent 020c5cd2d3
commit 9f48395596
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,7 @@ final class LuaDateTime {
case 'g' -> formatter.appendValueReduced(IsoFields.WEEK_BASED_YEAR, 2, 2, 0);
case 'G' -> formatter.appendValue(IsoFields.WEEK_BASED_YEAR);
case 'H' -> formatter.appendValue(ChronoField.HOUR_OF_DAY, 2);
case 'I' -> formatter.appendValue(ChronoField.HOUR_OF_AMPM, 2);
case 'I' -> formatter.appendValue(ChronoField.CLOCK_HOUR_OF_AMPM, 2);
case 'j' -> formatter.appendValue(ChronoField.DAY_OF_YEAR, 3);
case 'm' -> formatter.appendValue(ChronoField.MONTH_OF_YEAR, 2);
case 'M' -> formatter.appendValue(ChronoField.MINUTE_OF_HOUR, 2);

View File

@ -96,6 +96,9 @@ describe("The os library", function()
exp_code("%Y", "2000")
exp_code("%%", "%")
it("%r at 12 AM", function() expect(os.date("%r", 1670373922)):eq("12:45:22 AM") end)
it("%I at 12 AM", function() expect(os.date("%I", 1670373922)):eq("12") end)
it("zones are numbers", function()
local zone = os.date("%z", t1)
if not zone:match("^[+-]%d%d%d%d$") then