ericjgagnon / wickedpicker

A simple jQuery timepicker
http://ericjgagnon.github.io/wickedpicker/
MIT License
93 stars 78 forks source link

picker ignore time in input(rewrite it) #70

Open arheops opened 6 years ago

arheops commented 6 years ago

issue is at line 106

        showPicker: function (element) {
            //If there is a beforeShow function, then call it with the input calling the timepicker and the
            // timepicker itself
            if (typeof this.options.beforeShow === 'function') {
                this.options.beforeShow(element, this.timepicker);
            }
            var timepickerPos = $(element).offset();

            $(element).attr({'aria-showingpicker': 'true', 'tabindex': -1});
            //this.setText(element);

it setText to input BEFORE check input value different with internal state.

suggested change: remove line 106(works ok without that)

jaimestuardo commented 6 years ago

It did not work for me :-(

jaimestuardo commented 6 years ago

Finally, I have added this at line 79:

var currentTime = $(element).val().replace(/ /g, ''); if (currentTime != '') this.options.now = currentTime;

That works perfectly when there is already a value in the INPUT. If there is not, "now" options variable is used.