mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
* 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>
13 lines
476 B
JavaScript
13 lines
476 B
JavaScript
/**
|
|
* Converts from timezoneOffset (which corresponded to the value returned
|
|
* from moment.js's deprecated `moment#zone` method) to timezoneUtcOffset.
|
|
*
|
|
* This is done with conversion instead of changing it in the database to
|
|
* be backwards compatible with the database values and old clients.
|
|
*
|
|
* Not as a user method since it needs to work in the frontend as well.
|
|
*/
|
|
export default function getUtcOffset (user) {
|
|
return -(user.preferences.timezoneOffset || 0);
|
|
}
|