mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Move from deprecated moment#zone to moment#utcOffset (#12207)
* Issue 10209 - Remove read usages of zone * Issue 10209 - Add coverage on daysSince and startOfDay cron utility functions * Issue 10209 - Add unit test for daysUserHasMissed method * Issue 10209 - Remove usages of deprecated `moment.js#zone` method. * Issue 10209 - Add helper function to centralise logic Also simplify timezoneOffsetToUtc function in site.vue * Issue 10209 - Also add getUtcOffset as method on user Co-authored-by: Matteo Pagliazzi <matteopagliazzi@gmail.com>
This commit is contained in:
@@ -153,12 +153,12 @@ describe('GET /tasks/user', () => {
|
||||
});
|
||||
|
||||
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
|
||||
const timezone = 420;
|
||||
const timezoneOffset = 420;
|
||||
await user.update({
|
||||
'preferences.dayStart': 0,
|
||||
'preferences.timezoneOffset': timezone,
|
||||
'preferences.timezoneOffset': timezoneOffset,
|
||||
});
|
||||
const startDate = moment().zone(timezone).subtract('4', 'days').startOf('day')
|
||||
const startDate = moment().utcOffset(-timezoneOffset).subtract('4', 'days').startOf('day')
|
||||
.toISOString();
|
||||
await user.post('/tasks/user', [
|
||||
{
|
||||
@@ -180,12 +180,12 @@ describe('GET /tasks/user', () => {
|
||||
});
|
||||
|
||||
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
|
||||
const timezone = 240;
|
||||
const timezoneOffset = 240;
|
||||
await user.update({
|
||||
'preferences.dayStart': 0,
|
||||
'preferences.timezoneOffset': timezone,
|
||||
'preferences.timezoneOffset': timezoneOffset,
|
||||
});
|
||||
const startDate = moment().zone(timezone).subtract('4', 'days').startOf('day')
|
||||
const startDate = moment().utcOffset(-timezoneOffset).subtract('4', 'days').startOf('day')
|
||||
.toISOString();
|
||||
await user.post('/tasks/user', [
|
||||
{
|
||||
@@ -207,12 +207,12 @@ describe('GET /tasks/user', () => {
|
||||
});
|
||||
|
||||
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
|
||||
const timezone = 540;
|
||||
const timezoneOffset = 540;
|
||||
await user.update({
|
||||
'preferences.dayStart': 0,
|
||||
'preferences.timezoneOffset': timezone,
|
||||
'preferences.timezoneOffset': timezoneOffset,
|
||||
});
|
||||
const startDate = moment().zone(timezone).subtract('4', 'days').startOf('day')
|
||||
const startDate = moment().utcOffset(-timezoneOffset).subtract('4', 'days').startOf('day')
|
||||
.toISOString();
|
||||
await user.post('/tasks/user', [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user