From: TGJG-XPS\TracyG Date: Sat, 4 Feb 2017 12:33:22 +0000 (+0000) Subject: Removed rfc2822 prefix from internal variables. X-Git-Tag: 2.18.0~12^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8bec68f8c95151d04c2d18ccedbd72b53562f22;p=thirdparty%2Fmoment.git Removed rfc2822 prefix from internal variables. --- diff --git a/src/lib/create/from-string.js b/src/lib/create/from-string.js index f787fc73e..34063cbb8 100644 --- a/src/lib/create/from-string.js +++ b/src/lib/create/from-string.js @@ -135,7 +135,7 @@ var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|M export function configFromRFC2822(config) { var string, match, dayFormat, dateFormat, timeFormat, tzFormat; - var rfc2822Timezones = { + var timezones = { ' GMT': ' +0000', ' EDT': ' -0400', ' EST': ' -0500', @@ -146,8 +146,8 @@ export function configFromRFC2822(config) { ' PDT': ' -0700', ' PST': ' -0800' }; - var rfc2822Military = 'YXWVUTSRQPONZABCDEFGHIKLM'; - var rfc2822Timezone, rfc2822Index; + var Military = 'YXWVUTSRQPONZABCDEFGHIKLM'; + var timezone, timezoneIndex; string = config._i .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace @@ -175,22 +175,22 @@ export function configFromRFC2822(config) { switch (match[5].length) { case 2: // Military - if (rfc2822Index === 0) { - rfc2822Timezone = ' +0000'; + if (timezoneIndex === 0) { + timezone = ' +0000'; } else { - rfc2822Index = rfc2822Military.indexOf(match[5][1]) - 12; - rfc2822Timezone = ((rfc2822Index < 0) ? ' -' : ' +') + - (('' + rfc2822Index).replace(/^-?/, '0')).match(/..$/)[0] + '00'; + timezoneIndex = Military.indexOf(match[5][1]) - 12; + timezone = ((timezoneIndex < 0) ? ' -' : ' +') + + (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; } - rfc2822Timezone += '00'; + timezone += '00'; break; case 4: // Zone - rfc2822Timezone = rfc2822Timezones[match[5]]; + timezone = timezones[match[5]]; break; default: // UT or +/-9999 - rfc2822Timezone = rfc2822Timezones[' GMT']; + timezone = timezones[' GMT']; } - match[5] = rfc2822Timezone; + match[5] = timezone; config._i = match.splice(1).join(''); tzFormat = ' ZZ'; config._f = dayFormat + dateFormat + timeFormat + tzFormat;