Skip to content

Option getter always returns the source jquery object (1.0.2, 1.0.3, ..., 1.4.4) #434

Closed
@rbeurskens

Description

@rbeurskens

When requesting an option that is not 'getDate' , the query object itself is returned instead of the value(s) of the requested option.

suggested fix ( don't know if it is bulletproof ):

$.fn.extend({
    //########################################################################
    // shorthand just to use timepicker..
    //########################################################################
    timepicker: function(o) {
        o = o || {};
        var tmp_args = arguments;

        if (typeof o == 'object') { tmp_args[0] = $.extend(o, { timeOnly: true }); }

        var result = $(this).map(function() {        //  <---
            return /* <---- */ $.fn.datetimepicker.apply($(this), tmp_args); 
        });
        return (result[0]==$(this)[0]) ? result : result[0]; // <---

    },

    //########################################################################
    // extend timepicker to datepicker
    //########################################################################
    datetimepicker: function(o) {
        o = o || {};
        var tmp_args = arguments;

        if (typeof(o) == 'string'){
            if(o == 'getDate' /**/ ||  (o == 'option' && tmp_args.length == 2 && typeof (tmp_args[1]) == 'string')) /*<---*/) {
                return $.fn.datepicker.apply($(this[0]), tmp_args);
            }
            else {
                    return  = this.each(function () { 
                        $(this).datepicker.apply($t, tmp_args);  
                    });
            }
        }
        else {
            return this.each(function() {
                var $t = $(this);
                $t.datepicker($.timepicker._newInst($t, o)._defaults);
            });
        }
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions