mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
fix(task) - 11139 use start-from hours in due date calculation (#12609)
* fix(task) - 11139 use start-from hours in due date calculation * fix(task) - 11139 - Initial setup of Task unit test * Add more unit tests for formatDueDate
This commit is contained in:
@@ -1071,7 +1071,7 @@ export default {
|
||||
this.scoreChecklistItem({ taskId: this.task._id, itemId: item.id });
|
||||
},
|
||||
calculateTimeTillDue () {
|
||||
const endOfToday = moment().endOf('day');
|
||||
const endOfToday = moment().subtract(this.user.preferences.dayStart, 'hours').endOf('day');
|
||||
const endOfDueDate = moment(this.task.date).endOf('day');
|
||||
|
||||
return moment.duration(endOfDueDate.diff(endOfToday));
|
||||
@@ -1080,9 +1080,8 @@ export default {
|
||||
return this.calculateTimeTillDue().asDays() <= 0;
|
||||
},
|
||||
formatDueDate () {
|
||||
const dueIn = this.calculateTimeTillDue().asDays() === 0
|
||||
? this.$t('today')
|
||||
: this.calculateTimeTillDue().humanize(true);
|
||||
const timeTillDue = this.calculateTimeTillDue();
|
||||
const dueIn = timeTillDue.asDays() === 0 ? this.$t('today') : timeTillDue.humanize(true);
|
||||
|
||||
return this.task.date && this.$t('dueIn', { dueIn });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user