| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
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!
|
|
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?
|
|
I see no problem with this code. It is a work of art!
|
Re: Date Selector of the Damned
2012-06-18 11:33
•
by
jonny_q
(unregistered)
|
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. |
|
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".". |
|
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. |
|
Obviously you lack creativity. The worse version would involve inputting the date in Julian and writing a routine to convert it to Gregorian.
|
|
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. |
|
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 |
Re: All web developers?
2012-06-18 11:39
•
by
Anon
(unregistered)
|
Looks like the author of today's submission has been unearthed. |
|
> // final Date string to be passed to SAP is stored here
^^^^^ 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... |
Kasper is correct. You must validate all data on the server, because you cannot count on being in control of the client. Once you understand that, client-scripted validation is merely sugar to help the babies who don't know how to enter dates yet. |
Re: All web developers?
2012-06-18 11:48
•
by
mrfr0g
(unregistered)
|
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 |
|
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. |
Re: Date Selector of the Damned
2012-06-18 11:51
•
by
Neither Gilbert nor Sullivan
(unregistered)
|
Dammit. Now I've got The Pirates of Penzance running through my head. Thanks. |
|
Fortunately he didn't realize there are 30-day months and leap years :-)
|
Re: All web developers?
2012-06-18 11:53
•
by
Bob
(unregistered)
|
|
Woah, sensitive type. Bit too close to the bone, huh?
|
|
People still use Experts Exchange?
|
Re: Date Selector of the Damned
2012-06-18 11:55
•
by
Tasty
(unregistered)
|
I'd much rather use Julian Days than the Gregorian calendar. They're much more accurate. |
Re: All web developers?
2012-06-18 11:56
•
by
bewbs
(unregistered)
|
|
you mad bro?
|
Re: Date Selector of the Damned
2012-06-18 11:57
•
by
¯\(°_o)/¯ I DUNNO LOL
(unregistered)
|
|
TRWTF is that he didn't ask // string to int pretty please
At least the year field is wide enough for Y10K. |
Re: Date Selector of the Damned
2012-06-18 12:01
•
by
Anon
(unregistered)
|
I think that ship has sailed... |
|
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. |
Work on C++ started in 1979. So it could not have "held the state of the art in software back by several decades". Only by three decades. So far. |
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. |
|
This code is no excuse for being in field of computer programming.
|
Re: Date Selector of the Damned
2012-06-18 12:22
•
by
qbolec
(unregistered)
|
I would love to work in place that: 1. hires only graduates of CS as web developers 2. does not depend heavily on "designs" provided by Photo Shop artists as a GUI specs 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 :( |
|
It could have been written at a place which doesn't allow the use of any third party software other than the approved list.
|
|
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="0"></option>. |
|
I love this Mayan calendar implementation! 2013? There is no 2013!!!
|
Re: All web developers?
2012-06-18 12:51
•
by
Anon
(unregistered)
|
Wrong. http://xkcd.com/1070/ |
Re: All web developers?
2012-06-18 12:54
•
by
M
(unregistered)
|
Cue the obligatory xkcd reference, which happens to be today's comic! http://xkcd.com/1070/ |
Re: Date Selector of the Damned
2012-06-18 12:55
•
by
Dave
(unregistered)
|
Did you really just say that? |
Re: All web developers?
2012-06-18 12:57
•
by
Anon
(unregistered)
|
TRWTF is people who claim to be programmers but don't read xkcd every day. |
Re: Date Selector of the Damned
2012-06-18 13:03
•
by
C-Derb
(unregistered)
|
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?
|
That would have been wittier without "code". |
Re: All web developers?
2012-06-18 13:25
•
by
Karel
(unregistered)
|
|
Hi Patrick,
Nice one and you're right. But that's no reason to leave. There is good stuff too here. Cheers |
|
I am telling that expertsexchange is site what is producing the very very best results in Hyderabad.
|
|
The ONLY good thing about that code is at least the comments were polite
|
Re: Date Selector of the Damned
2012-06-18 13:43
•
by
wonk
(unregistered)
|
FTFY |
|
The real wtf is that he doesn't take into account for leap years. Amiright?
|
Re: All web developers? Well, all is a bit harsh
2012-06-18 13:52
•
by
TurdCrawler
(unregistered)
|
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)! |
You must provide both server side and client side evaluation else run the risk of being branded a lazy developer. |
|
// get current date and time from server
$.getJSON('/GetDateTime)', null, function (data) { wow. |
Re: All web developers?
2012-06-18 14:26
•
by
F
(unregistered)
|
TRWTF is people who claim to be readers of xkcd but haven't noticed it only appears three times a week. |
Re: All web developers?
2012-06-18 14:26
•
by
F
(unregistered)
|
TRWTF is people who claim to be readers of xkcd but haven't noticed it only appears three times a week. |
|
That is an elegant and beautiful solution to a completely non-existent problem.
|
Re: Javascript?
2012-06-18 14:32
•
by
Darth Paul
(unregistered)
|
Or tar to hinder those who do. |
Who cares how often it appears, they still read it everyday. Just like I come here everyday but it isn't updated every day. |
|
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... |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |