mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +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:
@@ -317,7 +317,7 @@ api.exportUserPrivateMessages = {
|
||||
async handler (req, res) {
|
||||
const { user } = res.locals;
|
||||
|
||||
const { timezoneOffset } = user.preferences;
|
||||
const timezoneUtcOffset = user.getUtcOffset();
|
||||
const dateFormat = user.preferences.dateFormat.toUpperCase();
|
||||
const TO = res.t('to');
|
||||
const FROM = res.t('from');
|
||||
@@ -329,7 +329,7 @@ api.exportUserPrivateMessages = {
|
||||
inbox.forEach((message, index) => {
|
||||
const recipientLabel = message.sent ? TO : FROM;
|
||||
const messageUser = message.user;
|
||||
const timestamp = moment.utc(message.timestamp).zone(timezoneOffset).format(`${dateFormat} HH:mm:ss`);
|
||||
const timestamp = moment.utc(message.timestamp).utcOffset(timezoneUtcOffset).format(`${dateFormat} HH:mm:ss`);
|
||||
const text = md.render(message.text);
|
||||
const pageIndex = `(${index + 1}/${inbox.length})`;
|
||||
messages += `
|
||||
|
||||
Reference in New Issue
Block a user