}
// 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]|[+-]\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-Z]|[a-ik-z]|[+-]\d{4}))$/;
// date and time from ref 2822 format
export function configFromRFC2822(config) {
if (timezoneIndex === 0) {
timezone = ' +0000';
} else {
- timezoneIndex = military.indexOf(match[5][1]) - 12;
+ timezoneIndex = military.indexOf((match[5][1]).toUpperCase()) - 12;
timezone = ((timezoneIndex < 0) ? ' -' : ' +') +
(('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00';
}
test('parsing RFC 2822', function (assert) {
var testCases = {
- 'clean RFC2822 datetime with all options': 'Tue, 01 Nov 2016 01:23:45 GMT',
+ 'clean RFC2822 datetime with all options': 'Tue, 01 Nov 2016 01:23:45 UT',
'clean RFC2822 datetime without comma': 'Tue 01 Nov 2016 01:23:45 GMT',
- 'clean RFC2822 datetime without seconds': 'Tue, 01 Nov 2016 01:23 GMT',
- 'clean RFC2822 datetime without century': 'Tue, 01 Nov 16 01:23:45 GMT',
- 'clean RFC2822 datetime without day': '01 Nov 2016 01:23:45 GMT',
+ 'clean RFC2822 datetime without seconds': 'Tue, 01 Nov 2016 01:23 +0000',
+ 'clean RFC2822 datetime without century': 'Tue, 01 Nov 16 01:23:45 Z',
+ 'clean RFC2822 datetime without day': '01 Nov 2016 01:23:45 z',
'clean RFC2822 datetime with single-digit day-of-month': 'Tue, 1 Nov 2016 01:23:45 GMT',
'RFC2822 datetime with CFWSs': '(Init Comment) Tue,\n 1 Nov 2016 (Split\n Comment) 01:23:45 +0000 (GMT)'
};