Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ
#337 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@bhushan4work がすでに取り組んでいます。

2026年10月24日 から。

  • #340 @bhushan4work による — マージ済み

評価

この issue はまだ評価されていません。

説明

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.

主要言語
TypeScript
スター
1
フォーク
9
平均マージ
7時間 17分
マージ済み PR(30日)
158

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codercops/toolbelt のほかの issue

codercops/toolbelt の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。