

Just apply the plugin to an HTML element and you're ready to select multiple dates :)
#Jquery disabled datepicker setdate code#
To see how it is implemented simply check the source code of this page: I've tried to keep the code simple and clear :) Here are some demos for you to understand how it works and what you can obtain with it. Set Example: $('#simpliest-usage').multiDatesPicker('value', ', ') ĭestroys the MDP and Datepicker instances on the element.Įxample: $('#simpliest-usage').multiDatesPicker('destroy') Get Example: var dates = $('#simpliest-usage').multiDatesPicker('value') Otherwise parses the string for dates to add. If no parameter is passed, returns the string value that would be used in input elements. Retrives the array of dates associated with the multiDatesPicker in the specified format: "string" (default) for localized string format, or "object" for javascript date object format.Įxample: var dates = $('#simpliest-usage').multiDatesPicker('getDates')

The date can be passed as string or as javascript date object.Įxample toggling today: $('#simpliest-usage').multiDatesPicker('toggleDate', new Date()) The array of dates to reset can be of type 'picked' (default) or 'disabled'.Įxample resetting disabled dates: $('#simpliest-usage').multiDatesPicker('resetDates', 'disabled') Īdds/removes a single date from the calendar. The parameter dates can be a single value or an array of milliseconds, strings or date object.Įxample removing today date: $('#simpliest-usage').multiDatesPicker('removeDates', new Date()) Removes one or more dates from the dates array using their dates. The parameter indexes can be an integer or an array of integers.Įxample removing first date: $('#simpliest-usage').multiDatesPicker('removeIndexes', 0) Removes one or more dates from the dates array using their indexes. The parameter dates can be a string, a date object or an array (of strings or javascript date objects).Įxample adding today: $('#simpliest-usage').multiDatesPicker('addDates', new Date()) The parameter dates can be a string or a date object.Įxample: $('#simpliest-usage').multiDatesPicker('gotDate', new Date()) Returns the index of the date in the dates array, or false in case that date is not found.

Both numbers may be negativeĬompares two dates returning 1, 0 or -1 if date2 is greater, equal or smaller than date1 respectively. Limits the range of dates available for selection to a certainĪ boolean that allows to maintain the number of pickable daysĮven in case there are disabled days within the rangeĪnd try toggling this flag to see the results.Īrray of two integers: the first sets the beginning of the range relative to the date clicked on
#Jquery disabled datepicker setdate how to#
NOTE: the string format you should pass to multiDatePicker depends on the localization of datepicker, see this page for more infos on how to configure it.ĭisables an array of dates specified in a string, milliseconds or javascript date object format.Īllows to specify a custom separator for the string representation of the dates selected (defaults ", ").Īllows to enable a different MDP modes: 'normal' (default) or 'daysRange'. $(selector).multiDatesPicker(options_for_datepicker_and_mdp) MultiDatesPicker specific optionsĪdds an array of dates specified in a string, milliseconds or javascript date object format. To apply it to an element, do it the same way as you would do with jQuery UI datepicker, but write multiDatesPicker instead of datepicker: Being an extension to jQuery UI DatePicker you need to include both jQuery and jQuery UI (with datepicker module included!) javascript files to your HTML page, and right after that, include MultiDatesPicker.
