diff --git a/src/plugins/team-goal-mixin.js b/src/plugins/team-goal-mixin.js index a3e4c3eb1d..487e9dcb84 100644 --- a/src/plugins/team-goal-mixin.js +++ b/src/plugins/team-goal-mixin.js @@ -1,4 +1,4 @@ -import { intervalToDuration, getDaysInMonth } from 'date-fns'; +import { differenceInDays } from 'date-fns'; export default { props: { @@ -48,17 +48,10 @@ export default { daysLeft() { const start = this.goal?.startDate ? new Date(this.goal?.startDate) : new Date(); const end = this.goal?.endDate ? new Date(this.goal?.endDate) : new Date(); - const interval = intervalToDuration({ - start, + return differenceInDays( end, - }); - - if (interval?.months) { - const daysInMonth = getDaysInMonth(start); - return interval.days + (interval.months * daysInMonth); - } - - return interval?.days ?? 0; + start, + ); }, challengeDescription() { return this.goal?.description ?? '';