Browse Source

Add timezone info to notification message (#786)

pull/1/head
Alexandr Velikiy 5 years ago committed by rozetko
parent
commit
970556b410
  1. 4
      server/src/utils/time.ts

4
server/src/utils/time.ts

@ -4,6 +4,7 @@ import * as _ from 'lodash';
import * as moment from 'moment';
const MINUTES_IN_HOUR = 60;
const TIME_FORMAT = 'ddd MMM DD YYYY HH:mm:ss UTCZ';
export function parseTimeZone(timeZone: string): number {
timeZone = timeZone.replace(/['|"]/g, '');
@ -23,5 +24,6 @@ export function parseTimeZone(timeZone: string): number {
export function toTimeZone(time: moment.MomentInput): string {
const utcTime = moment(time).utc();
const timeWithOffset = utcTime.utcOffset(TIMEZONE_UTC_OFFSET);
return timeWithOffset.format('ddd MMM DD YYYY HH:mm:ss');
return timeWithOffset.format(TIME_FORMAT);
}

Loading…
Cancel
Save