Timestamp converter turns "February 30, 2024" into March 1 instead of rejecting it
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 9
- Merge medio
- 7h 30m
- PR unite (30g)
- 151
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/toolbelt
-
fix(UI): shortcut popover overflowsForse già presa @DeepakNegi13 l’ha presa 1 giorno fa. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
codercops/toolbelt#333 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Copy buttons in the URL encoder and JWT decoder are all named just "Copy"Forse già presa @bhushan4work l’ha presa 1 giorno fa. Apertaaccessibility bug good first issue hacktoberfest
codercops/toolbelt#335 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Cron explainer says "on weekdays" for `0 0 1-31 * 1-5`, but the next runs include weekendsForse già presa @Saifjafri212213 l’ha presa 2 giorni fa. Apertabug hacktoberfest help wanted
codercops/toolbelt#329 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
UUID generator's v7 batch comes out in random order instead of time orderForse già presa @omisha123 l’ha presa 2 giorni fa. Apertabug good first issue hacktoberfest
codercops/toolbelt#316 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON formatter's "Did you mean" hint reads inside strings, so a missing comma near a URL says to remove commentsForse già presa @kachamsiddarth l’ha presa 2 giorni fa. Apertabug good first issue hacktoberfest
codercops/toolbelt#314 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/toolbelt
Issue simili
-
bug require-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
expressjs/expressjs.com#2549 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
umami-software/umami#4686 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --displayForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
pingdotgg/t3code#24900 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
inu-appcenter/UNIDorm-web#411 ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni