Click here to Skip to main content
15,887,683 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: This seriously belongs here... Pin
Daniel Pfeffer16-Sep-17 20:22
professionalDaniel Pfeffer16-Sep-17 20:22 
GeneralRe: This seriously belongs here... Pin
Dave Kreskowiak17-Sep-17 4:48
mveDave Kreskowiak17-Sep-17 4:48 
GeneralRe: This seriously belongs here... PinPopular
Richard Deeming19-Sep-17 2:28
mveRichard Deeming19-Sep-17 2:28 
GeneralRe: This seriously belongs here... Pin
Baraaaaaa20-Sep-17 4:13
Baraaaaaa20-Sep-17 4:13 
GeneralRe: This seriously belongs here... Pin
BuggyTimes21-Sep-17 1:01
BuggyTimes21-Sep-17 1:01 
GeneralRe: This seriously belongs here... Pin
Fueled By Decaff21-Sep-17 23:05
Fueled By Decaff21-Sep-17 23:05 
GeneralRe: This seriously belongs here... Pin
Eddy Vluggen24-Sep-17 0:15
professionalEddy Vluggen24-Sep-17 0:15 
GeneralOnce a DatePicker always a DatePicker Pin
Brady Kelly9-Sep-17 6:08
Brady Kelly9-Sep-17 6:08 
After finding this ultra-cool Bootstrap `DateTimePicker`, I thought I could simply select all my date-pickers by class, and apply the relevant code for the `DateTimePicker`, and I’d have elegant and working date-time pickers all over.

That was during that usual “honeymoon” period when you’ve just found a really cool hammer and can only see nails. That period passes quite quickly and then we’re left to deal with little niggly wrinkles to iron out on your new widget.

The first and biggest is that MVC “has already” turned one of my date-time inputs into a built-in browser native date picker. On Edge and Chrome the built-in picker is usable, but not good UX and somewhat unintuitive. I don’t know how other browsers present date and time pickers. If a model property is of `DateTime`, MVC scaffolds an input with type `datetime-local`, and lets the browser deal with the rest.

The code to initialize the DateTimePicker is normally simple, just call on your date-time input, like this:
$(".date-picker").datetimepicker();

Now when I did that, something weird happened. When I clicked any date-picker (input with class `date-picker`), I’d see two date-pickers: My new fancy one in the background, and overlaid on top of that, the browser date-picker – in my case Edge.

I have to first make the input a normal text input, and then the fancy DateTimePicker, for things to work as wanted, with the 3rd party date-picker in charge:
$(".date-picker").attr("type", "text");
$(".date-picker").datetimepicker();

Now I have one last “little” problem. When I click on one of my date-picklers, I get a history dropdown of recently used dates, but I suspect it is the browser’s date-picker doing this, because it drops down over my date-picker rendering it useless. Fortunately, a second click shows my date-picker without the dropdown.
"'Do what thou wilt...' is to bid Stars to shine, Vines to bear grapes, Water to seek its level; man is the only being in Nature that has striven to set himself at odds with himself."
—Aleister Crowley

GeneralRe: Once a DatePicker always a DatePicker Pin
KarstenK9-Sep-17 6:26
mveKarstenK9-Sep-17 6:26 
GeneralRe: Once a DatePicker always a DatePicker Pin
Brady Kelly9-Sep-17 21:45
Brady Kelly9-Sep-17 21:45 
GeneralRe: Once a DatePicker always a DatePicker Pin
Richard Deeming12-Sep-17 2:24
mveRichard Deeming12-Sep-17 2:24 
GeneralRe: Once a DatePicker always a DatePicker Pin
Brady Kelly12-Sep-17 18:28
Brady Kelly12-Sep-17 18:28 
GeneralOh maaan... Pin
PIEBALDconsult26-Aug-17 17:40
mvePIEBALDconsult26-Aug-17 17:40 
GeneralRe: Oh maaan... Pin
Daniel Pfeffer26-Aug-17 18:39
professionalDaniel Pfeffer26-Aug-17 18:39 
GeneralRe: Oh maaan... Pin
Bohdan Stupak19-Sep-17 5:07
professionalBohdan Stupak19-Sep-17 5:07 
RantDarn you Microsoft! Pin
PIEBALDconsult25-Aug-17 18:14
mvePIEBALDconsult25-Aug-17 18:14 
AnswerRe: Darn you Microsoft! Pin
RickZeeland25-Aug-17 19:57
mveRickZeeland25-Aug-17 19:57 
GeneralRe: Darn you Microsoft! Pin
Ron Anders26-Aug-17 7:15
Ron Anders26-Aug-17 7:15 
GeneralRe: Darn you Microsoft! Pin
Richard Deeming29-Aug-17 2:49
mveRichard Deeming29-Aug-17 2:49 
GeneralRe: Darn you Microsoft! Pin
PIEBALDconsult29-Aug-17 16:36
mvePIEBALDconsult29-Aug-17 16:36 
JokeRe: Darn you Microsoft! Pin
Richard Deeming30-Aug-17 1:02
mveRichard Deeming30-Aug-17 1:02 
GeneralRe: Darn you Microsoft! Pin
PIEBALDconsult30-Aug-17 3:10
mvePIEBALDconsult30-Aug-17 3:10 
GeneralThe Wierd and the Wonderful lives up to its name Pin
jsc4225-Aug-17 6:02
professionaljsc4225-Aug-17 6:02 
GeneralRe: The Wierd and the Wonderful lives up to its name Pin
MarkTJohnson25-Aug-17 6:45
professionalMarkTJohnson25-Aug-17 6:45 
GeneralRe: The Wierd and the Wonderful lives up to its name Pin
Richard Deeming25-Aug-17 7:09
mveRichard Deeming25-Aug-17 7:09 

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.