为datepicker假日数组添加标题

时间:2012-10-19 13:19:27

标签: datepicker android-datepicker android-date

有没有办法将自定义titles添加到数组中,以便每个holiday都拥有自己的title而不是广义的Date Unavailable

var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
var unavailableDates = ["2012/11/12","2012/11/22","2012/12/25","2013/01/01","2013/01/21","2013/02/18","2013/05/27","2013/04/04","2013/09/02","2013/10/14","2013/11/11","2013/11/28","2013/12/25"]; // yyyy/MM/dd 
var unavailableDays = ["Saturday","Sunday"];

function unavailable(date) {
ymd = date.getFullYear() + "/" + ("0"+(date.getMonth()+1)).slice(-2) + "/" + ("0"+date.getDate()).slice(-2);
day = new Date(ymd).getDay();
if ($.inArray(ymd, unavailableDates) < 0 && $.inArray(days[day], unavailableDays) < 0) {
   return [true, "enabled", "Select Date"];
 } else {
      return [false,"disabled","Date Unavailable"];
 }
}
$('#transfer-date').datepicker({beforeShowDay:unavailable, showOn: 'button', buttonImage: '../../images/icon-calendar.png', buttonImageOnly: true,});

0 个答案:

没有答案