如果选择的日期是明天,我想发出警报。这就是我所拥有的:
$('#dateInput').datepicker({
onSelect: function(dateText, inst) {
if (Date.parse(today)+1 == Date.parse(selectedDate)) {
alert('tomorrow!');
}
}
});
我怎样才能让它工作?
如果选择的日期是明天,我想发出警报。这就是我所拥有的:
$('#dateInput').datepicker({
onSelect: function(dateText, inst) {
if (Date.parse(today)+1 == Date.parse(selectedDate)) {
alert('tomorrow!');
}
}
});
我怎样才能让它工作?
这将在明天被解雇,而不是在明天的同一天被解雇:
$('#dateInput').datepicker({
onSelect: function(dateText, inst) {
var date_now = new Date();
var date_today = date_now.getDate();
var date_thismonth = date_now.getMonth();
var date_thisyear = date_now.getFullYear();
if (date_thisyear == inst.selectedYear &&
date_thismonth == inst.selectedMonth &&
(date_today+1) == inst.selectedDay){
alert('tomorrow!');
}
}
});?
$('#dateInput').datepicker({
onSelect: function(dateText, inst) {
var todayDate = new Date();
var tomorrowDate = new Date(todayDate.getTime() + (24 * 60 * 60 * 1000)).setHours(0,0,0,0);
var inputDate = new Date(dateText);
if (tomorrowDate - inputDate == 0) {
alert('tomorrow!');
}
}
});
$('#dateInput').datepicker({
onSelect: function(dateText, inst) {
var tomorrow = new Date();
tomorrow.setHours(0,0,0,0);
tomorrow.setDate(tomorrow.getDate()+1);
if (tomorrow.getTime() == Date.parse(dateText)) {
alert('tomorrow!');
}
}
});