Allow user to deselect all days during week

This commit is contained in:
Keith Holliday
2017-05-22 08:37:45 -06:00
parent fefaed368a
commit 280b720c13
2 changed files with 3 additions and 1 deletions

View File

@@ -393,10 +393,11 @@ angular.module('habitrpg')
var options = angular.copy(user); var options = angular.copy(user);
options.nextDue = true; options.nextDue = true;
var nextDueDates = Shared.shouldDo(new Date, task, options); var nextDueDates = Shared.shouldDo(new Date, task, options);
if (!nextDueDates) return '';
let dateFormat = 'MM-DD-YYYY'; let dateFormat = 'MM-DD-YYYY';
if (user.preferences.dateFormat) dateFormat = user.preferences.dateFormat.toUpperCase(); if (user.preferences.dateFormat) dateFormat = user.preferences.dateFormat.toUpperCase();
console.log(dateFormat);
var nextDue = nextDueDates.map(function (date) { var nextDue = nextDueDates.map(function (date) {
return date.format(dateFormat); return date.format(dateFormat);
}); });

View File

@@ -131,6 +131,7 @@ export function shouldDo (day, dailyTask, options = {}) {
let differenceInWeeks = moment(startOfDayWithCDSTime).week() - moment(startDate).week(); let differenceInWeeks = moment(startOfDayWithCDSTime).week() - moment(startDate).week();
let matchEveryX = differenceInWeeks % dailyTask.everyX === 0; let matchEveryX = differenceInWeeks % dailyTask.everyX === 0;
if (daysOfTheWeek.length === 0) return false;
schedule = schedule.every(daysOfTheWeek).daysOfWeek(); schedule = schedule.every(daysOfTheWeek).daysOfWeek();
if (options.nextDue) { if (options.nextDue) {