Slot times are shown with their own copy of the HH:MM rule that saving them checks

Aperta
#805 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@novakzx ci sta già lavorando.

Dal 6/11/2026.

  • #808 di @novakzx — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
backend, testing

Direzione di ricerca

Read src/lib/slot-label.ts and src/lib/reminder-fields.ts, then inspect slot-label.test.ts and run it to establish the current formatting behavior. Update formatSlotTime to validate through isRealTime and extract the hour and minutes by position, preserving the existing output. Done when the HH:MM regex is gone from slot-label.ts and the existing tests pass; an open linked pull request (#808) already covers this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement good first issue pipeline:ready

What happens

A Time field's value is checked and shown by two different rules:

  • Saving. isRealTime in src/lib/reminder-fields.ts decides whether a value is a real time. The slot-field service, Magic Compose, the share message and the reminder anchor all use it, and the MCP tools reach it through the services.
  • Showing. formatSlotTime in src/lib/slot-label.ts uses its own regex, TIME_OF_DAY = /^([01]\d|2[0-3]):([0-5]\d)$/. Everything that shows a time goes through it: renderFieldValue (the public page and emails), the Build tab's TimeSelect, column headers and the share text.

Today the two accept exactly the same strings. A check of all 10,000 dd:dd strings plus 24 edge cases found no disagreement. But if one changes (to allow 9:30, or a time range as #590 proposes), the page and the validator stop agreeing, and a saved time would print raw instead of as "6:30 PM".

slot-label.ts already imports isRealDate from reminder-fields.ts for dates, so times are the odd one out.

Fix, in outline

  • In formatSlotTime, delete TIME_OF_DAY and check the value with isRealTime (already in a module slot-label.ts imports).
  • Take the hour and minutes from the string by position (slice(0, 2), slice(3)), since isRealTime has already checked it is exactly HH:MM.

Watch for

  • Keep the output byte-identical. The space before AM/PM is a non-breaking space on purpose (see the comment on formatSlotTime). The existing tests in slot-label.test.ts cover 24:00, 9:30 and the empty string; they must still pass unchanged.
  • Leave the date regex alone. DATE_ONLY in slot-label.ts only picks how a string is parsed, and validity already goes through isRealDate.
  • The SQL copies in old migrations (0005_…, 0006_…) are applied history. Don't touch them.
  • #622 (open, proposed) would add a locale argument to formatSlotTime. It doesn't touch the regex, so whichever lands second has a small merge.

Done when

  • slot-label.ts has no HH:MM regex of its own, and formatSlotTime checks with isRealTime.
  • slot-label.test.ts passes unchanged.
  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test pass.

Found by the pipeline's refactor scout in the reminder jobs and their src/lib helpers (src/lib/slot-label.ts, src/lib/reminder-fields.ts), at d1e9e14. Checked by an independent verify agent, which grepped every HH:MM and YYYY-MM-DD pattern in the repo and ran 10,024 strings through both time rules with no disagreement. https://claude.ai/code/session_016YZ9SSPmh7nC1k9RsPc5NE

Lingua principale
TypeScript
Stelle
19
Fork
4
Merge medio
19h 27m
PR unite (30g)
199

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di richshaw/OpenSignup

Tutte le issue di richshaw/OpenSignup

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.