- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So in Joe's case, part of the WTF is Joe constructing a date from a difference of dates. (This sounds a lot like a JS WTF rather than a Joe WTF.)
With this expression:
(new Date("05/21/2024").getTime() - new Date("05/17/2004").getTime()) / (1000*60*60*24)
, we get an answer in days, specifically 7309 as I write this. (The difference of the getTime() values is normally in milliseconds...) If we divide this by 365 (or, more accurately for the period in question, 365.25), we get an answer that's a thin hair over 20. If we divide by 366 (this year is a leap-year, after all), we get an answer that's a thin hair under 20, 19.9699stuff...Praise be the "Console" mode in browser Dev Tools.
Addendum 2024-05-24 06:54: Bah, two clicks sur "submit"... I suck. And this so-called comment system also sucks.
Addendum 2024-05-24 06:55: s/sur/on/ in the previous addendum. I've been living in France for too long.
Admin
Once again demonstrating that computer science professors rarely know how software works.
Admin
The Wikipedia one is an artifact of the (somewhat aggressive) page rendering cache strategy that is used by the WMF to keep their datacenter budget under control. Annoying, but I would not call that a WTF on the same level as others on this site. (The age computation ultimately comes from https://en.wikipedia.org/w/index.php?title=Module:Date&oldid=970908888#L-1660--L-1682 which looks legit at a first glance.)
Admin
Observation: someone refreshed the cached data, so now it shows 20 years as it should.
Admin
Must have been Tina
Admin
The JS in the screenshot was intended to show the date when the image was taken, as well as what the "year" difference would be using a simple equation. The biggest reason I submitted it was the humor, a date "error" on Wikipedia's DailyWTF page. I found it amusing, figured others might as well.
Admin
Oh, for sure, I was amused by it. Thanks.
Admin
I don't know how you can tell that Date module is legit. I spent a half-hour trying to understand it and now I hate the world and it's not even noon yet. Perhaps my faculties are failing me.
Admin
I was talking about the specific lines that I linked (the link requires JavaScript to work unfortunately), which is the core age computation algorithm. The overall structure of the module is indeed horrific.
Addendum 2024-05-27 08:40: I especially hate the
_diff_age
function, which was unfortunately in the call stack between the article’s screenshot and my finding of these lines.