this post was submitted on 04 Nov 2023
658 points (98.1% liked)

Programmer Humor

19187 readers
1513 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 24 points 10 months ago (1 children)

What people fail to see is that this is the largest date the API can store, not a magical cutoff date in the distant future.

You could create a date today and send it to the API, and it could potentially crash it, or create a buffer overrun.

[โ€“] [email protected] 8 points 10 months ago

The definition of the Date object explicitly states that any attempt to set the internal timestamp to a value outside of the maximum range must result in it being set to "NaN". If there's an implementation out there that doesn't do that, then the issue is with that implementation, not the standard.