Skip to content

Commit

Permalink
fix(typing): fix DATE_NEXT_DAY hours 馃悰
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBrisorgueil committed Mar 25, 2020
1 parent 0c06eaf commit 52038b8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/helpers/typing/dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ exports.DATE_NEXT_DAY = (data) => {
let date;
const target = Number(data);
const today = Number(moment().date());
if (target >= today) date = moment().add(target - today, 'days').format();
else date = moment().add(1, 'months').subtract(today - target, 'days').format();
if (target >= today) {
date = moment()
.add(target - today, 'days')
.startOf('day')
.format();
} else {
date = moment().add(1, 'months')
.subtract(today - target, 'days')
.startOf('day')
.format();
}
return date;
};

Expand Down

0 comments on commit 52038b8

Please sign in to comment.