Skip to content

Commit

Permalink
Fix calculation of days to due
Browse files Browse the repository at this point in the history
  • Loading branch information
hakatashi committed Apr 26, 2017
1 parent 9b0cd83 commit d1582a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assignment-notifier.js
Expand Up @@ -168,7 +168,7 @@ module.exports = () => Promise.try(() => {

assignments.forEach((assignment) => {
const dueDate = moment.tz(assignment.dueDate, 'Asia/Tokyo');
const daysToDue = Math.ceil(dueDate.diff(now, 'days', true));
const daysToDue = dueDate.diff(today, 'days');

if (daysToDue === 1) {
const title = `「${assignment.h2} ${assignment.h3}」は明日の${assignment.dueTime}が期限です!`;
Expand Down Expand Up @@ -208,7 +208,7 @@ module.exports = () => Promise.try(() => {

assignments.forEach((assignment) => {
const dueDate = moment.tz(assignment.dueDate, 'Asia/Tokyo');
const daysToDue = dueDate.diff(now, 'days', true);
const daysToDue = dueDate.diff(today, 'days');
const dueDateString = dueDate.locale('ja').format('MM/DD (ddd)')

if (0 <= daysToDue && daysToDue <= 6) {
Expand Down

0 comments on commit d1582a4

Please sign in to comment.