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

Abierto
#805 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@novakzx ya está trabajando en esto.

Desde el 6/11/2026.

  • #808 de @novakzx — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
typescript
Área
backend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
19
Forks
4
Merge medio
19 h 27 min
PR fusionados (30 d)
199

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de richshaw/OpenSignup

Todos los issues de richshaw/OpenSignup

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.