this post was submitted on 28 Apr 2024
18 points (100.0% liked)

Aviation

344 readers
5 users here now

Anything related to aircraft, airplanes, aviation and flying. Helicopters & rotorcraft, airships, balloons, paragliders, winged suits and anything that sustains you in the air is acceptable to post here.

founded 2 years ago
MODERATORS
top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 9 months ago

So it’s the Y2K bug, but stupider.

As a sidenote: Did you know that the Date object in JavaScript has a getFullYear method? It just gives you the year of the date. For instance: new Date(1995, 0, 1).getFullYear() gives 1995.

Why is it called getFullYear, you ask? Well, there’s also getYear, which only gives the last two digits of the year. For instance: new Date(1995, 0, 1).getYear() gives 95. Not as useful as you might think, but ok.

Now what happens in the year 2000? Guess. No, really. Do guess. And then guess again, because you’re wrong. new Date(2024, 0, 1).getYear() gives …drumroll… 124, not 24. After the year 1999 the counter just keeps incrementing.

So what’s before 1900, then? new Date(1776, 6, 4) was, of course, the year −124.

I think it’s worth noting that JavaScript isn’t an ancient language. It was developed in December 1995. The year 2000 wasn’t too far off.