Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Timestamp converter turns "February 30, 2024" into March 1 instead of rejecting it

Cerrado
#337 2 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@bhushan4work ya está trabajando en esto.

Desde el 24/10/2026.

  • #340 de @bhushan4work — fusionado

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug hacktoberfest help wanted

Type 2024-02-30 into the timestamp converter's Date to epoch field and it says the date isn't valid. Type February 30, 2024 (or Feb 30 2024, or 2024/02/30) and it converts it to March 1, 2024. toEpoch (lib/time-utils.ts, line 129) only checks for impossible days when the input starts with YYYY-MM-DD (hasImpossibleCalendarDay, lines 111 to 127). Anything else goes straight to Date.parse, which rolls the day over into the next month.

What to do

  • Catch impossible days in the other formats Date.parse accepts. One way: when the input has a day and a month (a name like February or Feb, or the numbers in 2024/02/30), compare them with the month and day of the parsed date, and reject the input when they don't match.

Where to look

  • lib/time-utils.ts: hasImpossibleCalendarDay and toEpoch
  • lib/__tests__/time-utils.test.ts

Acceptance criteria

  • February 30, 2024, Feb 30 2024 and 2024/02/30 are rejected like 2024-02-30
  • Real dates in those formats (February 29, 2024, 2024/02/29) still convert
  • Tests that fail on the current code
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #337 in the description.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
9
Merge medio
8 h 8 min
PR fusionados (30 d)
155

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 codercops/toolbelt

Todos los issues de codercops/toolbelt

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.