mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
* WIP: #12555 -dayOfMonth takes timezone into account on task update for monthly dailys -startDate set to start of day in user's tz on task update for monthly dailys -tweaked a test so that it's actually testing something * WIP: 12555 -task.startDate gets set to start of day in user's tz on task creation and task update -set preferences.timezoneOffset to nonzero value in certian test user objects -removed date literals in test:api-v3:integration:tasks:PUT
This commit is contained in:
@@ -124,6 +124,15 @@ export async function createTasks (req, res, options = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
// set startDate to midnight in the user's timezone
|
||||
if (taskType === 'daily') {
|
||||
const awareStartDate = moment(newTask.startDate).utcOffset(-user.preferences.timezoneOffset);
|
||||
if (awareStartDate.format('HMsS') !== '0000') {
|
||||
awareStartDate.startOf('day');
|
||||
newTask.startDate = awareStartDate.toDate();
|
||||
}
|
||||
}
|
||||
|
||||
setNextDue(newTask, user);
|
||||
|
||||
// Validate that the task is valid and throw if it isn't
|
||||
|
||||
Reference in New Issue
Block a user