From: TGJG-XPS\TracyG Date: Mon, 6 Mar 2017 22:03:15 +0000 (+0000) Subject: Correction to military case insensitive time zone X-Git-Tag: 2.18.0~12^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e37659c29b3a3958c19d024b710e53e1089bbcd5;p=thirdparty%2Fmoment.git Correction to military case insensitive time zone --- diff --git a/src/lib/create/from-string.js b/src/lib/create/from-string.js index cc7c3592d..38069dc95 100644 --- a/src/lib/create/from-string.js +++ b/src/lib/create/from-string.js @@ -94,7 +94,7 @@ export function configFromISO(config) { } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 -var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Z]|[a-ik-z]|[+-]\d{4}))$/; +var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/; // date and time from ref 2822 format export function configFromRFC2822(config) { @@ -142,7 +142,7 @@ export function configFromRFC2822(config) { if (timezoneIndex === 0) { timezone = ' +0000'; } else { - timezoneIndex = military.indexOf((match[5][1]).toUpperCase()) - 12; + timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; timezone = ((timezoneIndex < 0) ? ' -' : ' +') + (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; }