[dateinput] : Selectors cause improper behavior #541

diptimansingh opened this Issue Oct 24, 2011 · 5 comments

4 participants


When you have "selectors: true", and attempt to use selectors to change the month/year, the entire calendar (with selectors) get disabled / unusable. You cannot choose another date from that instant.

I guess the script crashes at the onclick point of the selectors.


I can confirm - using this as a demo:

<!DOCTYPE html>
    <title>jQuery Tools standalone demo</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <!-- include the Tools -->
    <script src="dateInput.126.js"></script>
    <!--<script src="http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js"></script>-->
    <!-- standalone page styling (can be removed) -->
    <link rel="stylesheet" type="text/css" href="http://static.flowplayer.org/tools/css/standalone.css"/>
    <!-- dateinput styling -->
    <link rel="stylesheet" type="text/css" href="http://static.flowplayer.org/tools/demos/dateinput/css/skin1.css"/>
    <!-- HTML5 date input -->
    <input type="date" name="mydate" />
    <!-- make it happen -->
    $(":date").dateinput({ selectors: true });

...breaks DateInput; as soon as either of the selectors is used, then it disables all days in the month, and changes it back to December 2006? Scrolling backwards (forwards is not present), it then enables the days, but they are from 2006 (for me)...

Updating status to confirmed.


year and month values should be converted to integer before setValue is called
something like this can fix the problem
// month selector
monthSelector.unbind("change").change(function() {
self.setValue(integer(yearSelector.val()), integer($(this).val()));

// year selector
yearSelector.unbind("change").change(function() {
self.setValue(integer($(this).val()), integer(monthSelector.val()));


setValue actually does that already... so that would have no effect


as I can see setValue does:
if (typeof year == 'string') { date = parseDate(year); }
that is causing the problem in case of setValue("2011", "10") (it is called this way from selectors change events)
because parseDate expects ISO formatted date string setValue("2011-10-30")


ah sorry, you're right... that change works. committed ...

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