Browse Source

Fix for #782 (#784)

- remove " and ' symbols from timezone
- fix regexp (add checks for start and end of the string)
pull/1/head
Alexandr Velikiy 5 years ago committed by rozetko
parent
commit
5194bacffa
  1. 3
      server/src/utils/time.ts

3
server/src/utils/time.ts

@ -6,7 +6,8 @@ import * as moment from 'moment';
const MINUTES_IN_HOUR = 60;
export function parseTimeZone(timeZone: string): number {
const re = /\b-?\d{1,2}?:\d{2}\b/;
timeZone = timeZone.replace(/['|"]/g, '');
const re = /^-?\d{1,2}?:\d{2}$/;
const correctFormat = re.test(timeZone);
if(!correctFormat) {
throw new Error(`Wrong timeZone format in config - "TIMEZONE_UTC_OFFSET": ${timeZone}`);

Loading…
Cancel
Save