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

Global variables maxDateTime and minDateTime #789

Closed wcamarao closed 9 years ago

wcamarao commented 9 years ago

Hi there,

I'd like to propose a change, and I'm willing to submit a PR for it. Please let me know if you agree with the proposed change so I can fork the repo and submit the PR.

Currently, maxDateTime and minDateTime are globals, which means you can't have multiple elements on the page with different maxDateTime and minDateTime values.

E.g.:

        elementOne.datetimepicker({
            minDateTime: new Date(),
        });

        elementTwo.datetimepicker({
            maxDateTime: new Date(),
        });

The first element is setup correctly, with only its minDateTime. However, the latter is setup incorrectly, because it "inherits" the minDateTime from the global _defaults. The proposal is to make maxDateTime and minDateTime instance variables on a per-element basis, instead of globals.

Please let me know your thoughts on this. Thanks.

wcamarao commented 9 years ago

Apologies for the noise here, after upgrading to 1.5.0 it worked fine.