Issue
i have try many solutions but not working to validating the current date with enter date by user in functions parameters date passed from the user how to perform validation how to validate the date
isToday(date) {
const today = new Date()
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear();
};
isToday(2020-09-07)
above code is not working can any one help
thanks in advance
Solution
2020-09-07 is not a Date object you need to call isToday with new Date('2020-09-07')
Answered By - Tim Lepage
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.