]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Correction to military case insensitive time zone
authorTGJG-XPS\TracyG <tracyg.gilmore@gmail.com>
Mon, 6 Mar 2017 22:03:15 +0000 (22:03 +0000)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 12 Mar 2017 00:11:46 +0000 (02:11 +0200)
src/lib/create/from-string.js

index cc7c3592dda222fd582cd7550af3e27b7896a179..38069dc95846a07c2d9f96fa01f613574042666f 100644 (file)
@@ -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';
                 }