trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

defaultValue when focus #635

Open WiCD opened 11 years ago

WiCD commented 11 years ago

I don't want the default value of 'date + " 00:00"', placed in when focused, and defaultValue option didn't work.

$(...).datetimepicker( { defaultValue: "" // null didn't work either... })

UOAlien commented 11 years ago

I'll confirm this. Even with defaultValue set to null (default), clicking on a textbox with a timepicker will set it to midnight.

I've tracked this down to line 500-504 (of the current version):

if (this.inst !== null) {
    var timeDefined = this.timeDefined;
    this._onTimeChange();
    this.timeDefined = timeDefined;
}

I commented out the this._onTimeChange(); and it stopped it from happening. Is there any way we can make the 'close' (Done) button set the textbox to what is selected?

UOAlien commented 11 years ago

Commenting out that line breaks manually changing the text, though :(

WiCD commented 11 years ago

im temporarily using this form to avoid the default value:

$("#dt").datetimepicker( {
        timezone : 'GMT',
        timezoneList : [ {
            value : 'GMT',
            label : "GMT"
        }]
    });
WiCD commented 11 years ago

notice that, if there's no 'z' (Timezone) in timeFormat, it won't provide a timezone drop list, so it looks just fine

judgedim commented 10 years ago

I think fixed in https://github.com/trentrichardson/jQuery-Timepicker-Addon/pull/648