Timestamp converter turns "February 30, 2024" into March 1 instead of rejecting it
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- TypeScript
- スター
- 1
- フォーク
- 9
- 平均マージ
- 7時間 17分
- マージ済み PR(30日)
- 158
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/toolbelt のほかの issue
-
documentation good first issue hacktoberfest seo
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
codercops/toolbelt#364 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
UUID generator's v7 batch comes out in random order instead of time order対応中かも @omisha123 が 3 日前に担当しました。 オープンbug good first issue hacktoberfest
codercops/toolbelt#316 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Base64 decode error points at the wrong character when the input has spaces or line breaks対応中かも @Aaqibhafeezkhan が 3 日前に担当しました。 オープンbug good first issue hacktoberfest
codercops/toolbelt#310 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Guide: how to check color contrast for WCAG対応中かも @08abhinav が 4 日前に担当しました。 オープンdocumentation good first issue hacktoberfest seo
codercops/toolbelt#276 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Guide: how to convert a Unix timestamp to a date and back対応中かも @varun-pahuja が 4 日前に担当しました。 オープンdocumentation good first issue hacktoberfest seo
codercops/toolbelt#275 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
codercops/toolbelt の issue をすべて見る
似ている issue
-
Add: ON Phim Viet SDオープンcheck:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
area:agents area:cost bug platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
anthropics/claude-code#105375 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
galaxyproject/loom#616 ·
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
redhat-developer/rhdh-plugin-export-overlays#4580 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信