Skip to content

Conversation

@marvinschroeder
Copy link

Sorry for my bad english! I hope you are getting it: I am using datepicker and timepicker as standalone instances on one single page. By using the "altField" the base "_updateAlternate" sets the val() of the altField to the date value of the datepickers, not to the properly val() of the timepickers instances. So i override it and check if the "altFieldTimeOnly" option is set and then put the right formatted time in the altField's val().

…icker and timepicker as standalone instances on one single page. By using the "altField" the base "_updateAlternate" sets the val() of the altField to the date value of the datepickers, not to the properly val() of the timepickers instances. So i override it and check if the "altFieldTimeOnly" option is set and then put the right formatted time in the altField's val().
@ktruk
Copy link

ktruk commented Sep 2, 2011

I am also using separate Date and Time fields. When a user manually types in a date to the field directly it appears in the time field as a date, overwriting the time that was in the field. I am using altField. Could this be a related problem?

@trentrichardson
Copy link
Owner

You may have correctly implemented but for safety sake and expecting future datepicker changes it may be best to create a copy of the original datepicker function have a look at how $.datepicker._formatDate function flows:

$.datepicker._base_formatDate=$.datepicker._formatDate;
$.datepicker._formatDate = function(inst, day, month, year){
    var tp_inst = this._get(inst, 'timepicker');
    if(tp_inst)
    {
        if(day)
            var b = this._base_formatDate(inst, day, month, year);
        tp_inst._updateDateTime();  
        return tp_inst.$input.val();
    }
    return this._base_formatDate(inst);
}

You see it first copies the original function to $datepicker._base_formatDate. Then in our new function it first checks to see if there is a timepicker, otherwise it calls the original function. This will keep our hands out of datepicker as much as possible so timepicker doesn't kill stand alone datepickers.

Also if you could please issue pull requests from the dev branch as it has the most recent changes and features. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants