Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#337 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bhushan4work ci sta già lavorando.

Dal 24/10/2026.

  • #340 di @bhushan4work — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
TypeScript
Stelle
1
Fork
9
Merge medio
7h 30m
PR unite (30g)
151

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

Tutte le issue di codercops/toolbelt

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.