I'm having an issue trying to retrieve the next business day with my code. Currently, it is only displaying the day immediately following. Despite looking into similar questions for a solution, I have yet to identify the error.
While this question is related, it doesn't fully address my specific concern:
How to exclude weekends between two dates using Moment.js
$scope.businessDay = new Date();
if (moment().day() === 5) { // It's Friday, so show Monday
// Set to Monday
$scope.businessDay = moment().weekday(8).format("MMMM Do YYYY");
}
if (moment().day() === 6) { // It's Saturday, so show Monday
// Set to Monday
$scope.businessDay = moment().weekday(8).format("MMMM Do YYYY");
}
else { // For other days, display the next day
$scope.businessDay = moment().add('days', 1).format("MMMM Do YYYY");
}