Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion datepickBasic.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<script type="text/javascript">
$(function() {
$('#popupDatepicker').datepick();
$('#inlineDatepicker').datepick({onSelect: showDate});
$('#inlineDatepicker').datepick({
onSelect: showDate,
selectableDates: ['12-03-2014', '2014-03-16', '2014-03-20', '2014-03-05']
});
});

function showDate(date) {
Expand Down
19 changes: 19 additions & 0 deletions jquery.datepick.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function Datepicker() {
selectDefaultDate: false, // True to pre-select the default date if no other is chosen
minDate: null, // The minimum selectable date
maxDate: null, // The maximum selectable date
selectableDates: [], // array with timestams of selectable dates
dateFormat: 'mm/dd/yyyy', // Format for dates
autoSize: false, // True to size the input field according to the date format
rangeSelect: false, // Allows for selecting a date range on one date picker
Expand Down Expand Up @@ -1849,6 +1850,24 @@ $.extend(Datepicker.prototype, {
inst.options.onDate.apply(target, [drawDate, drawDate.getMonth() + 1 == month]));
var selectable = (selectOtherMonths || drawDate.getMonth() + 1 == month) &&
this._isSelectable(target, drawDate, dateInfo.selectable, minDate, maxDate);

var selDates = inst.options.selectableDates;

if(selectable) {
for(var i = 0; i < selDates.length; i++) {
var selDate = new Date(selDates[i]);
selectable = false;

if (drawDate.getYear() === selDate.getYear() &&
drawDate.getMonth() === selDate.getMonth() &&
drawDate.getDate() === selDate.getDate()) {

selectable = true;
break;
}
}
}

days += this._prepare(renderer.day, inst).replace(/\{day\}/g,
(selectable ? '<a href="javascript:void(0)"' : '<span') +
' class="dp' + ts + ' ' + (dateInfo.dateClass || '') +
Expand Down