- 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
The only way that I can currently think of to make that worse is to expect the user to enter the month in Morse code!
Admin
I know nothing of web development, but wouldn't it be reasonable to assume that there is some sort of calendar widget available that one might use instead of writing all that?
Admin
I see no problem with this code. It is a work of art!
Admin
HTML5 allows for <input type=date> and as browsers gain support for it, it will be that simple to display a date widget.
However, even today, not all browsers support it. Like the article said, there are a number of third-party scripts out there that do the job quite well. A very method is to include the jQuery UI lib on your page:
So, yes.
I dumbed down the code there a bit, and there's probably a more thorough answer, but that's the quick answer to your question.
Admin
Instead of JUST laughing at the programmer here, someone should replace that code with what ought to be there and then SHOW IT TO the programmer. Ask them what they think of the replacement.
Make a comment to them like "you know, there are some situations where, when you see them, you ought to think "I'm sure this has been solved before -- let's look around for the best and simplest way to implement this".".
Admin
There is not much reason to be using javascript in the first place. That page could have worked just as fine without any javascript. The only thing that javascript could really do for such a page is to present an error message to the user slightly faster, if the input is inconsistent (like specifying the 30th of February or such).
You are going to need validation on the server side anyway. As a user I'd much rather see a solution that only validates on the server side than one, that does a poor job of validating on the client side.
Admin
Obviously you lack creativity. The worse version would involve inputting the date in Julian and writing a routine to convert it to Gregorian.
Admin
Why is the year box about 40% wider than the other two?
Why is "check" abbreviated in the comments to "ck"?
Why Are the Alerts in Title Case!?
Why is the order month/day/year?
So many subtle things here.
Admin
Because web developers are the only programmers who write horribly mangled code, amirite? Please. And yet it is taboo to say that C/C++ have held the state of the art in software back by several decades due to their extreme low-level concepts and lack of portability?
Dear Daily WTF,
I came for the lulz, and left because of the sickening elitism among your submitters and commentors whose lives are now so devoid of meaning that the only pleasure they get is derived from heckling the less gifted.
Enjoy your passive aggressive snickering and your tiny cubicles while you hide from doing real work.
plonk
Sincerely, Patrick
Admin
Looks like the author of today's submission has been unearthed.
Admin
That's your first clue as to "why" right there.
Once you've spent some time with SAP, anything else looks good, especially on the UI front...
Admin
Admin
Hey congratulations! You just got the point of this website, to make fun of poorly written code. Today it is a javascript WTF, tomorrow it might be c/c++, Java, classic ASP, or really anything else "code" related.
I am a Web Developer, have been for a number of years and I can say with certainty that the code posted today is terrible, and deserves to be made fun of.
CATPCHA: letatio, some kind of levitating potato or Harry Potter spell
Admin
This is why college education is broken. They teach you so many things, except to look at the API. Go to any college class which is doing any development and show them the API to their current language... the looks of awe are simply amazing and the sheep stand there wondering of a whole new world of opportunities. So please people, stop reinventing new ways of fucking up date implementations. How many articles have appeared here where the subject is implementing his/her new Gregorian calendar? Oh! And TRWTF is JavaScript for not having a Date implementation like every other freaking major language in the world.
Admin
Admin
Fortunately he didn't realize there are 30-day months and leap years :-)
Admin
Woah, sensitive type. Bit too close to the bone, huh?
Admin
People still use Experts Exchange?
Admin
I'd much rather use Julian Days than the Gregorian calendar. They're much more accurate.
Admin
you mad bro?
[image]Admin
TRWTF is that he didn't ask // string to int pretty please
At least the year field is wide enough for Y10K.
Admin
I think that ship has sailed...
Admin
It's bad enough he had retarded practices, but he didn't have a logical understanding of programming.
I suppose GlobalVars.Day = parseInt($('#DaySelect').val()) would have been too easy; case statement clearly necessary.
Admin
Only by three decades.
So far.
Admin
While you're right that C is a horrible language and should never have been allowed to inflict its descendants upon the world, particularly after 1989 when the Morris Worm taught us that it was completely unsuited to development in any environment that came with security requirements, that really doesn't have anything to do with today's article, and it doesn't make the code any less horrible.
Admin
This code is no excuse for being in field of computer programming.
Admin
I would love to work in place that:
until then, I must say, that sadly, but we have developed more than one date-picker "control" even though some us knew that there is a plugin for that.
JPEG-driven development is my everyday nightmare. I believe the problem is that JPEGs say 1000 words to upper managment, while software architects just say a lot of sophisticated words which are hard to comprehend. What I believe is necessary is to develop a visual language in which architects could express their thoughts to managment. I am not talking about UML -- it's too complicated. Look for instance at the domain of real Architecture (that one which deals with buildings) : architects in that area olways provide visualisations, beautiful pictures, perspectives, and so on. CS lacks this kind of visual language :(
Admin
It could have been written at a place which doesn't allow the use of any third party software other than the approved list.
Admin
I'm calling shenanigans.
There's no way you could have more than a week of web development experience and not have the thought ever cross your mind to simply start the select lists with <option value="<b>0</b>"></option>.
Admin
I love this Mayan calendar implementation! 2013? There is no 2013!!!
Admin
http://xkcd.com/1070/
Admin
Cue the obligatory xkcd reference, which happens to be today's comic!
http://xkcd.com/1070/
Admin
Did you really just say that?
Admin
Admin
I thought the same thing. Why go to all the trouble of dynamically populating the the Year selector when the "validation" is limited to 2011 and 2012, unless you know something?
Admin
Admin
Hi Patrick,
Nice one and you're right. But that's no reason to leave. There is good stuff too here.
Cheers
Admin
I am telling that expertsexchange is site what is producing the very very best results in Hyderabad.
Admin
The ONLY good thing about that code is at least the comments were polite
Admin
FTFY
Admin
The real wtf is that he doesn't take into account for leap years. Amiright?
Admin
Dang! Before he left, we should have asked for some of his well-written code (to make fun of while we hide in our cubicles avoiding work)!
Admin
You must provide both server side and client side evaluation else run the risk of being branded a lazy developer.
Admin
// get current date and time from server $.getJSON('/GetDateTime)', null, function (data) {
wow.
Admin
TRWTF is people who claim to be readers of xkcd but haven't noticed it only appears three times a week.
Admin
TRWTF is people who claim to be readers of xkcd but haven't noticed it only appears three times a week.
Admin
That is an elegant and beautiful solution to a completely non-existent problem.
Admin
Or tar to hinder those who do.
Admin
Who cares how often it appears, they still read it everyday. Just like I come here everyday but it isn't updated every day.
Admin
To be fair, most date selector UIs are incredibly slow and clunky to use. They are mostly useful for figuring out a date that you aren't sure about, but they're often quite painful. If you already have the date in mind then typing it is usually far easier. A smart text box that turns anything you type into a known date would be handy. Better than a "date picker", as they're generally called. A calendar view is useful for associating days with weeks or counting days, but not much else...
Also, JavaScript reliance is evil. Also, that code is really bad...