Repository navigation
fix: reset timer locales at UTC, Gregorian dates, es-ES AM/PM, and two picker fixes - #782
Merged
Merged
Conversation
With the 12-hour clock in date mode, the Block and Weekly Reset Timers turn the locale's day period into AM/PM by dropping its dots and uppercasing it. That works for "am", "pm", "a.m." and "p.m.", but ICU writes es-ES's as "a. m." and "p. m.", with a space after the first dot, so the timers showed "10:30 A M CEST" in the status line and the preview. Locales typed in by hand such as ca, bs and es-AR write it the same way. Drop each dot together with the space after it, so "a. m." becomes "AM" like the other forms, while a day period without dots keeps its spaces.
In date mode, the Block and Weekly Reset Timers ask Intl for the year, month and day in the chosen locale and fill them into a YYYY-MM-DD layout, without saying which calendar to use. ar-SA, which the locale picker offers, defaults to Gregorian in Node's ICU data but to the Islamic (Umm al-Qura) calendar in Bun's, where the month comes back as a name even though two digits were asked for. The same settings then showed "٢٠٢٦-١٠-١٣ ١٦:٠٥" under npx and "١٤٤٨-جمادى الأولى-٠٢ ١٦:٠٥" under bunx: a Hijri year with its era dropped and a month name inside the numeric layout. th-TH (Buddhist year 2569) and fa-IR (Persian year 1405) typed in by hand gave non-Gregorian dates under both runtimes. Ask for the Gregorian calendar, so the parts always fit the layout and both runtimes print the same date. The locale keeps its own digits, as it already does in its zone name and time.
The Block and Weekly Reset Timers offer a locale in date mode whatever
the timezone, and the line editor shows it ("locale: de-DE"). But with
the timezone at its default, UTC, the formatter returned its fixed
English format before it looked at the locale, so the weekday names and
day period stayed English: "Sun 08:30 UTC" for de-DE and "8:30 AM UTC"
for ja-JP, while Etc/UTC, the same zone under another name, gave
"So 08:30 UTC" and "8:30 午前 UTC".
When a locale is set, format UTC through Intl in that locale, as every
other zone already is. The output keeps the UTC format's shape: every
locale names the zone "UTC", and compact mode still ends in "Z". Without
a locale the fixed format is unchanged, and en-US gives the same output
as no locale.
The reset timers' locale picker searches each listed locale by a few keywords, and en-GB's include 'uk' and en-CA's 'ca'. It also offers a search that is a valid locale tag not in the list as a "Use <tag>" custom row, placed first. 'uk' and 'ca' are valid tags too, for Ukrainian and Catalan, so typing either put "Use uk" or "Use ca" above en-GB or en-CA, and since the picker selects the first row after each keystroke, Enter saved Ukrainian or Catalan formatting. Put a locale whose keywords include the search ahead of the custom row. The custom row still comes next, so a Ukrainian or Catalan tag is one Down away, and any other tag the list doesn't offer, such as en-AU, still comes first.
…oesn't list A reset timer's timezone picker should open on the configured zone, so Enter keeps it. A valid zone that Intl doesn't list, such as Asia/Kolkata (both Node and Bun list it as Asia/Calcutta) or Etc/GMT-5 picked under Bun and reopened under Node, gets its own "Configured timezone" row right after Local. The picker found the starting row's index in the options as given, but shows them sorted, and the sort puts that row after Africa/Abidjan. So the picker opened on Africa/Abidjan, and Enter without moving saved it, switching the reset time to GMT. Find the starting row in the list as the empty search shows it.
…stem or configured locale The locale picker lists the system locale and the configured locale in their own rows above the common ones, and drops the common row for the same locale. Those rows carried only "system ..." or "configured ..." search words, so when en-GB or en-CA was the system or configured locale, the 'uk' and 'ca' keywords went with the dropped row. Typing either put "Use uk" or "Use ca" first again and Enter saved Ukrainian or Catalan; for 'uk', en-GB was not even listed. That is the case for a UK or Canadian user under Node, which takes its default locale from LANG, and for anyone reopening the picker after choosing en-GB or en-CA. Give the System and Configured rows the keywords of the common locale they replace, so they match and rank the same way it would. The keyword tests now pin the runtime's locale: they passed under Bun, which reports en-US whatever LANG says, and failed under Node with LANG=en_GB.UTF-8 or en_CA.UTF-8.
With a locale set and the timezone left at its default, UTC, the full date-mode stamp now goes through Intl in that locale and takes the zone name Intl gives. For most locales that is "UTC", but a few spell it differently: el-GR writes "2026-03-15 08:30 Συντονισμένη Παγκόσμια Ώρα", and sd, ku, sc and so give "م ع و", "SGH", "TCU" and "Waqtiga UTC", the same under Bun and Node. Without a locale these stamps end in "UTC". At UTC, the full form now ends in the fixed "UTC" label, as compact mode already ends in a fixed "Z". The weekday, day period and digits still follow the locale. An explicitly chosen IANA zone such as Etc/UTC keeps Intl's zone name, as any other zone does.
With a locale set and the timezone at UTC, a reset timestamp goes through Intl in that locale, and keeps the fixed format when Intl can't use the locale. Only the localized outcome had tests. A POSIX-style tag such as "de_DE" is not a valid language tag, and Intl throws on it under both Bun and Node. The stamp then reads "Sun 08:30 UTC" in the full form and "Sun 08:30Z" in compact mode, where de-DE gives "So 08:30 UTC" and "So 08:30Z".
formatUsageResetAt parsed the timestamp, split its overloaded locale-or-hour12 argument, and then held both zone paths inline: the UTC one, which tries the chosen locale, adds the compact "Z" and falls back to the fixed format, and the IANA or local one with its en-US fallback. The UTC path moves into formatResetAtUtcInLocale, next to formatResetAtUtc and formatResetAtInTimezone, the two formatters it chooses between. formatUsageResetAt now reads as parse, normalize, then format for the zone, and its UTC branch is a single call. The output is the same for every timezone, locale and option.
Contributor
|
Reproduced on current Red: 13 failing / 71 total — matching the "13 of the 16 fail, 3 are guards" claim. Clearest symptom: at UTC a de-DE timer renders Green: with the full PR head checked out, 71 passing / 0 failing. Note: verified with |
This was referenced Nov 7, 2026
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Five fixes to the Block and Weekly Reset Timers' date mode and to their locale and timezone pickers:
So 20:30 UTCfor de-DE,8:30 午後 UTCfor ja-JP.AM/PMinstead ofA M/P M.ukorcaselects en-GB or en-CA, also when that locale is the system or configured one. "Use uk" / "Use ca" moves to the next row.Why (evidence)
Sun 20:30 UTCwhile the line editor saidlocale: de-DE. Etc/UTC, the same zone under another name, gaveSo 20:30 UTC.YYYY-MM-DDlayout, but no calendar was requested.new Intl.DateTimeFormat('ar-SA').resolvedOptions().calendarisgregoryin Node 26 andislamic-umalqurain Bun 1.4.2. With identical settings:npxprinted٢٠٢٦-١٠-١٨ ٢٣:٣٠ غرينتش+٣bunxprinted١٤٤٨-جمادى الأولى-٠٧ ٢٣:٣٠ غرينتش+٣, a Hijri year with its era dropped and a month name inside the numeric layout.a. m.(bytes61 2e 20 6d 2e). Dropping only the dots left the inner space:2026-10-16 10:30 P M CEST.uk/cain the locale picker. en-GB's search keywords includeukand en-CA's includeca. Both are also valid tags (Ukrainian, Catalan), and a valid tag the list doesn't offer was put first as a "Use " row. Since the picker selects the first row after each keystroke, typingukand pressing Enter saved Ukrainian, and the timer then showedнд 8:30 ДП GMT+0. When en-GB or en-CA was the system locale (Node takes it from LANG; Bun always reports en-US) or the configured one, its System or Configured row replaced the common row without its keywords, soukdid not list en-GB at all.Intl.supportedValuesOf('timeZone')doesn't list gets its own "Configured timezone" row. Asia/Kolkata is one: both runtimes list only Asia/Calcutta. A zone picked under Bun and reopened under Node, like Etc/GMT-5, is another. The picker took its starting index from the options as given but shows them sorted, so it opened on Africa/Abidjan, and Enter switched the zone to GMT.How
formatUsageResetAt: with a locale set and the zone UTC, format through Intl in that locale, as every other zone already does. The full form ends in a fixed "UTC", as it does without a locale, instead of the zone name Intl gives: a few locales name UTC otherwise, such as el-GR'sΣυντονισμένη Παγκόσμια Ώρα(6 languages, the same under both runtimes: blo, el, ku, sc, sd and so). Compact mode keeps itsZ. Without a locale, the fixed format is unchanged, and en-US gives the same output as no locale. A side effect: a locale with its own digits (ar-SA) now uses them at UTC too (٢٠٢٦-١٠-١٦ ٢٠:٣٠ UTC, was2026-10-16 20:30 UTC), as it already did in every other zone.formatResetAtInTimezone: requestcalendar: 'gregory', so the parts always fit the layout. This also overrides a typed-u-ca-…. The locale keeps its own digits, matching its zone name and time; Latin digits remain available by typingar-SA-u-nu-latn.normalizeDayPeriod: drop each dot together with the space after it.a. m.becomesAM, while day periods without dots keep their spaces (checked across 153 locales on both runtimes).filterLocaleOptions: a locale whose keywords include the search goes ahead of the custom row, which follows directly after it. A tag that matches no keyword, such asen-au, still comes first. A Ukrainian or Catalan user typing the bare code now presses Down once, or typesuk-UA/ca-ES, which still come first.getLocaleOptions: the System and Configured rows replace the common row for their locale, so they now carry that row's keywords and match and rank the same way.SearchableOptionEditor: find the starting row in the list the empty search shows. This fixes the locale and timezone pickers alike.Demo
Locale at UTC. ja-JP 12-hour Block Reset and de-DE weekday Weekly Reset, timezone left at UTC. Before:
8:30 PM UTC/Sun 20:30 UTC. After:8:30 午後 UTC/So 20:30 UTC.Powerline
Before:
After:
Plain
Before:
After:
es-ES 12-hour, Europe/Madrid.
10:30 P M CESTbecomes10:30 PM CEST, anddom 10:30 P Mbecomesdom 10:30 PM.Powerline
Before:
After:
Plain
Before:
After:
ar-SA, Asia/Riyadh, built CLI under Bun and Node. Before: Bun shows a Hijri date, Node a Gregorian one. After: both show the same Gregorian date. (The terminal draws the Arabic letters unjoined.)
Powerline
Before:
After:
Plain
Before:
After:
Locale picker: type
uk, then Enter. Before: "Use uk" is selected and the preview turns Cyrillic (locale: uk). After: en-GB is selected and saved.Powerline
Before:
After:
Plain
Before:
After:
Timezone picker with Asia/Kolkata configured: press
z, then Enter. Before: it opens on Africa/Abidjan and saves it (08:30 GMT). After: it opens on Asia/Kolkata and keeps it (14:00 GMT+5:30).Powerline
Before:
After:
Plain
Before:
After:
Testing
mainas of fix: use env override and settings for usable context ratio calculation #407 (71e8b42): merges cleanly,bun run lintis clean, andbun testgives 3954 pass, 0 fail. The built CLI under Bun 1.4.4 and Node 26.13.0 matchesmainin plain and Powerline mode with the baseline configs, and the TUI opens and exits cleanly. It adds no JavaScript or Node API newer than Node 14, the build's target.bun run lint: clean.bun test: 3184 pass, 0 fail, across 178 files (main: 3168).usage.test.ts(6): es-ES day period; Gregorian calendar for ar-SA, th-TH and fa-IR; locale at UTC; the fixed UTC label for el-GR at UTC; en-US at UTC unchanged; the fixed UTC format when Intl rejects the locale (de_DE).locales.test.ts(5): keyword vs custom-row ranking, and the same for en-GB/ukand en-CA/caas the System row and as the Configured row.locale-editor.test.tsx(3): Ink, typeuk, Enter saves en-GB, with en-GB as a common, system or configured locale.searchable-option-editor.test.tsx(2): Ink, opens on an unlisted configured value and Enter keeps it, for the locale and timezone editors.main's code, 13 of the 16 fail under both Bun and Node; the other 3 are guards.mainthey disagree. With el-GR at UTC, both runtimes print2026-10-16 20:30 UTCandΚυρ 20:30 UTC(main:Sun 20:30 UTC). The baseline piped render is unchanged, and the TUI opens and exits cleanly under both runtimes.