我尝试从 datepicker 插入选定日期的名称 - 到目前为止没有结果......
我的代码如下所示:
$("#date_from, #date_to").datepicker({
defaultDate: "+1d",
minDate: "+1d",
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy",
monthNamesShort: ["Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paz", "Lis", "Gru"],
dayNamesMin: ["Nie", "Pon", "Wt", "Śr", "Czw", "Pt", "Sob"],
numberOfMonths: 1,
constrainInput: true,
beforeShowDay: noWeekendsOrHolidays,
firstDay: 1, // Start with Monday
onSelect: function (dateText, inst) {
if (this.id == 'date_from') {
var dateMin = $('#date_from').datepicker("getDate");
var dateMax = $('#date_to').datepicker('getDate');
var rent_date_from = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 1);
var rent_date_to = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 29);
$('#date_to').datepicker("option", "minDate", rent_date_from);
$('#date_to').datepicker("option", "maxDate", rent_date_to);
}
$('#day_of_week1').val($.datepicker.formatDate('DD', dateMin));
$('#day_of_week2').val($.datepicker.formatDate('DD', dateMax));
compute(); //Add compute
}
});
我有两个input
字段(#day_of_week1
,#day_of_week2
)。我得到一个值,但只能从第一个字段(在 中#day_of_week1
),但我无法从第二个字段中获取值。不知道问题出在哪里?
谢谢你的帮助。