Click here to Skip to main content
15,887,246 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Just found this linked on The Daily WTF Forums... Pin
YaakovF11-May-17 0:55
YaakovF11-May-17 0:55 
GeneralThe Irony is Strong with W3 Schools Pin
Rob Grainger4-Apr-17 3:52
Rob Grainger4-Apr-17 3:52 
GeneralRe: The Irony is Strong with W3 Schools Pin
User 101325464-Apr-17 5:34
User 101325464-Apr-17 5:34 
GeneralRe: The Irony is Strong with W3 Schools Pin
jgakenhe4-Apr-17 18:24
professionaljgakenhe4-Apr-17 18:24 
GeneralRe: The Irony is Strong with W3 Schools Pin
dan!sh 4-Apr-17 19:09
professional dan!sh 4-Apr-17 19:09 
GeneralRe: The Irony is Strong with W3 Schools Pin
Super Lloyd4-Apr-17 19:27
Super Lloyd4-Apr-17 19:27 
GeneralRe: The Irony is Strong with W3 Schools Pin
kmoorevs5-Apr-17 9:39
kmoorevs5-Apr-17 9:39 
GeneralMicrosoft, Javascript and not cutting corners Pin
DerekT-P30-Mar-17 10:44
professionalDerekT-P30-Mar-17 10:44 
At the risk of highlighting a horrible quick-n-dirty workaround I wrote a few months back, has anyone else come across this?

I have some Javascript code that creates a date object, appends it to a URL, and does a GET to another page. At the server my (.Net) code then parses the date, but does some horrible clunky stuff to convert what Javascript has created into something .Net can parse. It does this by stripping off any reference to "GMT +0000 (GMT Standard Time)". The dates that Javascript formats when simply appending a date object a string are in the format
ddd MMM dd yyyy hh:MM:ss GMT+nnnn (xxxxxxx)
for instance
Fri Mar 24 2017 00:00:00 GMT+0000 (GMT Standard Time)

(BTW, this is an intranet app that ONLY runs on Chrome).

All worked well in testing. All worked well in live... until the user started entering dates after March 26th, when .Net was parsing the date as "01-01-0001". Debugging on my system revealed the problem was the shift to daylight saving (British Summer Time); so I (stupidly, as I suspected at the time!) changed the server-side code to also strip off any text "GMT +0100 (GMT Summer Time)" which is what my browser was sending. I tested, all was well, put code live.

Unfortunately this didn't resolve the problem for the user, and further investigation showed that, although they were on an identical version of Chrome, their system was sending "GMT +0100 (GMT Daylight Time)"; i.e. "Daylight Time" not "Summer Time".
Further investigation showed that the only difference between development and live was that their systems were running Windows 7 Pro, whereas my development system was on Windows 8. So, Microsoft, what on earth possessed you to change the name of the time zone between one version of Windows and another?? So much for forward compatibility... Frown | :( D'Oh! | :doh: Sigh | :sigh:

And yes, I am very much aware I should not be hard-coding timezone strings, even if this is an intranet app running in my own timezone... Cool | :cool:
GeneralRe: Microsoft, Javascript and not cutting corners Pin
raddevus30-Mar-17 11:15
mvaraddevus30-Mar-17 11:15 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
kmoorevs30-Mar-17 11:17
kmoorevs30-Mar-17 11:17 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
DerekT-P30-Mar-17 11:59
professionalDerekT-P30-Mar-17 11:59 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
twaindev30-Mar-17 20:39
twaindev30-Mar-17 20:39 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
DerekT-P30-Mar-17 20:58
professionalDerekT-P30-Mar-17 20:58 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
nplumridge30-Mar-17 22:30
nplumridge30-Mar-17 22:30 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Marco Bertschi30-Mar-17 11:43
protectorMarco Bertschi30-Mar-17 11:43 
AnswerRe: Microsoft, Javascript and not cutting corners Pin
Super Lloyd30-Mar-17 13:24
Super Lloyd30-Mar-17 13:24 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
kristopher.baker31-Mar-17 5:19
kristopher.baker31-Mar-17 5:19 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Super Lloyd31-Mar-17 7:43
Super Lloyd31-Mar-17 7:43 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Super Lloyd31-Mar-17 8:01
Super Lloyd31-Mar-17 8:01 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Richard Deeming31-Mar-17 8:41
mveRichard Deeming31-Mar-17 8:41 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Super Lloyd31-Mar-17 8:56
Super Lloyd31-Mar-17 8:56 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Richard Deeming31-Mar-17 8:58
mveRichard Deeming31-Mar-17 8:58 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Super Lloyd31-Mar-17 10:12
Super Lloyd31-Mar-17 10:12 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Plamen Dragiyski30-Mar-17 20:19
professionalPlamen Dragiyski30-Mar-17 20:19 
GeneralRe: Microsoft, Javascript and not cutting corners Pin
Jochen Arndt30-Mar-17 21:05
professionalJochen Arndt30-Mar-17 21:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.