mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2372] [Issue]: Roleplay World tile drops AM/PM on spaced 12-hour times (24-hour regex tried before meridiem) #1172
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1172
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2372
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Low — correctness (regression vs main). In the roleplay tracker World tile,
getWorldTimeDisplayruns the 24-hour regex before the meridiem regex, so a 12-hour time with a space before AM/PM (e.g.6:00 PM) matches the 24-hour pattern and the AM/PM label is dropped. The tile shows a bare06:00for an evening time. Main tries the meridiem regex first and renders06:00 PM.Expected behavior
6:00 PMshould display as06:00 PM(hour 18, meridiem suffix shown), matching main. Times that include AM/PM should keep their meridiem label.Actual behavior
src/features/runtime/world-state/lib/world-state-display.ts:177-211tries the 24-hour regex first (line 181) and only falls back to meridiem (line 194):For
6:00 PMthe trailing space is a word boundary, so\b([01]?\d|2[0-3])[:.h]([0-5]\d)\bmatches the6:00portion and thePMis silently dropped →{ hour: 6, suffix: "" }. Same inversion for3:30 PM,8:15 am,6:00 p.m.. (6:00pmwith no space parses correctly on both branches, because the missing word boundary makes the 24h regex miss.)Consumed in roleplay via
RoleplayHUDWorldWidget.tsx:61and the expandedWorldStatePanelTime tile (WorldDateTimeTiles.tsx:100,113-122).WorldDateTimeTiles.tsx:119-122only rendersdisplay.suffixwhen present, so an evening6:00 PMshows a bare06:00with no PM badge — it reads as morning.Scope correction (so this is not over-stated): the analog clock face is not wrong. Both
WorldClockFace(WorldDateTimeTiles.tsx:70) and the HUD widget (RoleplayHUDWorldWidget.tsx:64) compute the hand angle fromhour % 12, so hour 6 and hour 18 produce the same hand position. The only user-visible loss is the dropped AM/PM label on the numeric time. Numeric time and editability are preserved.Steps to reproduce
6:00 PMor3:30 PM(colon + space + AM/PM — the form LLMs overwhelmingly produce).06:00for an evening time).Impact area
Environment
330f69a8H:MM AM/PMtimesLogs, screenshots, or video
Static source audit. Reproduced by running both regexes side by side: refactor
6:00 pm→{ path: 24h, hour: 6, suffix: "" }vs main{ path: meridiem, hour: 18, suffix: "PM" }.Regression notes
Regression vs main — worked on main, broken on refactor. Main's
getWorldTimeDisplay(packages/client/src/features/tracker-panel/lib/world-state-display.ts:209) tries the meridiem regex first and the 24-hour regex second (:224), so6:00 pm→ hour 18, suffixPM.Additional context
Fix sketch: run the meridiem match before the 24-hour match (as main does), or add a negative lookahead to the 24h regex so it does not consume an
H:MMimmediately followed by optional whitespace +a/p/m, e.g....([0-5]\d)\b(?!\s*[ap]\.?m?\.?\b). Keep the refactor-only additions (the[:.h]separator support and the keyword-hour fallback); only the branch ordering needs to change.No open issue covers time-string parse ordering. Not a duplicate of #2317 / #2327 / #2294.
Template check
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2381, merged into
refactor(squash54c12e71).