Skip to content

Conversation

@flakey5
Copy link
Member

@flakey5 flakey5 commented Jan 21, 2025

Closes #262

@flakey5 flakey5 requested a review from a team as a code owner January 21, 2025 21:36
@targos
Copy link
Member

targos commented Jan 21, 2025

Maybe I'm missing something, but the fix doesn't look right. At least in Node.js, an invalid date is still an instance of Date.

Copy link
Member

@MattIPv4 MattIPv4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @targos noted, checking if a date is an instance of Date does not tell you whether its invalid or not -- you need check using the global isNaN.

isNaN(new Date()); // false
isNaN(new Date("aaa")); // true

@MattIPv4
Copy link
Member

Could a test or two be added for these headers when they're set to valid + invalid values in requests?

@ovflowd
Copy link
Member

ovflowd commented Jan 26, 2025

Could a test or two be added for these headers when they're set to valid + invalid values in requests?

cc @flakey5

Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
flakey5 and others added 3 commits January 27, 2025 14:12
Co-authored-by: Matt Cowley <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Signed-off-by: flakey5 <[email protected]>
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff!

@flakey5 flakey5 merged commit 9ca242d into main Jan 28, 2025
5 checks passed
@flakey5 flakey5 deleted the flakey5/262 branch January 28, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: The value cannot be converted because it is not a valid Date.

5 participants