Timestamp converter turns "February 30, 2024" into March 1 instead of rejecting it
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.parseaccepts. One way: when the input has a day and a month (a name likeFebruaryorFeb, or the numbers in2024/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:hasImpossibleCalendarDayandtoEpochlib/__tests__/time-utils.test.ts
Acceptance criteria
-
February 30, 2024,Feb 30 2024and2024/02/30are rejected like2024-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 testandnpm run buildpass
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
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/toolbelt
-
Timestamp converter still turns "02/30/2024" into March 1Posiblemente ocupada @bfs2021 la tomó hoy. Abiertobug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
codercops/toolbelt#345 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Cron explainer says "on weekdays" for `0 0 1-31 * 1-5`, but the next runs include weekendsPosiblemente ocupada @Saifjafri212213 la tomó hace 2 días. Abiertobug hacktoberfest help wanted
codercops/toolbelt#329 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
UUID generator's v7 batch comes out in random order instead of time orderPosiblemente ocupada @omisha123 la tomó hace 2 días. Abiertobug good first issue hacktoberfest
codercops/toolbelt#316 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
JSON formatter's "Did you mean" hint reads inside strings, so a missing comma near a URL says to remove commentsPosiblemente ocupada @kachamsiddarth la tomó hace 2 días. Abiertobug good first issue hacktoberfest
codercops/toolbelt#314 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Base64 decode error points at the wrong character when the input has spaces or line breaksPosiblemente ocupada @Aaqibhafeezkhan la tomó hace 2 días. Abiertobug good first issue hacktoberfest
codercops/toolbelt#310 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/toolbelt
Issues similares
-
type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
0️⃣ phase/new
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
microsoft/playwright#43640 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100