jQuery Date Select Boxes Plugin

View Demo

Get the plugin: Date Select Boxes
Git: https://github.com/NickABusey/jQuery-Date-Select-Boxes-Plugin

A simple way to implement smart date select boxes. Given month, day, and year select boxes, this plugin will automatically populate the day select box with the proper amount of days for a given year and month combination, taking leap years into account. Includes and uses jQuery Select Box Manipulation plugin.

Usage: $().dateSelectBoxes($(‘#birthMonth’),$(‘#birthDay’),$(‘#birthYear’), keepDayLabel);

Where keepDayLabel is a boolean to say whether or not you want to preserve the first element in the select (e.g., a value-less, descriptive option used as a label (e.g., ‘day’))

View Demo

11 thoughts on “jQuery Date Select Boxes Plugin

  1. The only thing i would like to see is that, for example, february 29 2008 was selected, but then the year amended to 2010, instead of the day selected the default ‘day’, the script automatically selects the max day of the month.

    Other than that, its ace.

  2. @Nico Thanks!

    @Daniel I considered this when building the plugin, but thought it might introduce errors in data entry. If the user picked a date that clearly doesn’t exist, this will force them to recheck the date they are entering and make sure it is correct, rather than defaulting to the closest available date.

  3. @Nick Thanks.

    Is here the possibility to provide some code that would allow this functionality as an option as opposed to the core of the code?

    Thanks

  4. @Nico Thanks.

    I was wondering if there is a update to the select boxes, allowing the script to update the fields day and month to disable the past dates based on the year selected?

    Thanks

  5. Hey Nick…how would this be integrated into results returned from a DB. I pull a date from the DB and want the values to be selected in the dropdowns. Doesn’t seem the selected option is built in… am I missing something?

  6. @Daniel B.

    If you have selected a year.. You can’t by nature of a select box select a date in the past. That month and day is of the year selected. What would you be disabling? It is different then say the jquery datepicker. To achieve what you are talking about would be to require that the year not be shown at all because in relation to today, you would be looking for no dates in the past. And limiting the months then days available based on today’s date… can’t say it would really make much sense to use this plug-in in that case. It would be very unintuitive for a user vs the jquery datepicker which already has that limitation functionality built in.

  7. There is a bug in the script, if you change month value to feb, and select day as 28, it will select internally to 29, while building options for Day combo box one value is increased by +1

    look into it, you can understand

Leave a Reply

Your email address will not be published. Required fields are marked *