I am trying to compare some dates in javascript/jquery. But I am getting some error. What I did wrong here?
dayRender: function (date, cell) {
console.log(date.getTime())
}
//here am geting date.getTime is not a function
Here is my function:
$scope.myFunction =function(balance){
$('#fullCalendar').fullCalendar({
defaultDate: balance.defaultDate,
editable: true,
eventLimit: true,
events: [
{
title: balance.title,
start: balance.startDate
}
],
dayRender: function (date, cell) { // This is the callback function to modify a particular date cell.
console.log(date.getDate()); //undefined
}
});
}
var date = new Date(); console.log(date.getDate());
Instead of passing date object everytime you call dayRender()
, you can use date directly in that function.
dayRender: function (cell) {
var date = new Date();
console.log(date.getTime());
console.log(date.getDate());
console.log(date.getYear());
}
Try to convert date into date object hope it works
dayRender: function (date, cell) {
dateObj =new Date(date);
console.log(date.getDate());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.