"use strict";
var datetime = require('../../../src/util/datetime-util');
function run() {
    describe('convertDataToISO', function () {
        it('should convert DateTimeData to datetime string, +330 tz offset', function () {
            var data = {
                year: 1994,
                month: 12,
                day: 15,
                hour: 13,
                minute: 47,
                second: 20,
                millisecond: 789,
                tzOffset: 330,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('1994-12-15T13:47:20.789+05:30');
        });
        it('should convert DateTimeData to datetime string, Z timezone', function () {
            var data = {
                year: 1994,
                month: 12,
                day: 15,
                hour: 13,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('1994-12-15T13:00:00Z');
        });
        it('should convert DateTimeData to YYYY-MM-DD', function () {
            var data = {
                year: 1994,
                month: 1,
                day: 1,
                hour: null,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('1994-01-01');
        });
        it('should convert DateTimeData to YYYY-MM', function () {
            var data = {
                year: 1994,
                month: 1,
                day: null,
                hour: null,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('1994-01');
        });
        it('should convert DateTimeData to YYYY', function () {
            var data = {
                year: 1994,
                month: null,
                day: null,
                hour: null,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('1994');
        });
        it('should convert DateTimeData to HH:mm:SS.SSS', function () {
            var data = {
                year: null,
                month: null,
                day: null,
                hour: 13,
                minute: 47,
                second: 20,
                millisecond: 789,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('13:47:20.789');
        });
        it('should convert DateTimeData to HH:mm:SS string', function () {
            var data = {
                year: null,
                month: null,
                day: null,
                hour: 13,
                minute: 47,
                second: 20,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('13:47:20');
        });
        it('should convert DateTimeData to HH:mm string', function () {
            var data = {
                year: null,
                month: null,
                day: null,
                hour: 13,
                minute: 47,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('13:47');
        });
        it('should not convert DateTimeData with null data', function () {
            var data = {
                year: null,
                month: null,
                day: null,
                hour: null,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            var str = datetime.convertDataToISO(data);
            expect(str).toEqual('');
            var str = datetime.convertDataToISO({});
            expect(str).toEqual('');
        });
    });
    describe('convertFormatToKey', function () {
        it('should convert year formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('YYYY')).toEqual('year');
            expect(datetime.convertFormatToKey('YY')).toEqual('year');
        });
        it('should convert month formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('MMMM')).toEqual('month');
            expect(datetime.convertFormatToKey('MMM')).toEqual('month');
            expect(datetime.convertFormatToKey('MM')).toEqual('month');
            expect(datetime.convertFormatToKey('M')).toEqual('month');
        });
        it('should convert day formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('DDDD')).toEqual('day');
            expect(datetime.convertFormatToKey('DDD')).toEqual('day');
            expect(datetime.convertFormatToKey('DD')).toEqual('day');
            expect(datetime.convertFormatToKey('D')).toEqual('day');
        });
        it('should convert hour formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('HH')).toEqual('hour');
            expect(datetime.convertFormatToKey('H')).toEqual('hour');
            expect(datetime.convertFormatToKey('hh')).toEqual('hour');
            expect(datetime.convertFormatToKey('h')).toEqual('hour');
        });
        it('should convert minute formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('mm')).toEqual('minute');
            expect(datetime.convertFormatToKey('m')).toEqual('minute');
        });
        it('should convert am/pm formats to their DateParse key', function () {
            expect(datetime.convertFormatToKey('A')).toEqual('ampm');
            expect(datetime.convertFormatToKey('a')).toEqual('ampm');
        });
    });
    describe('getValueFromFormat', function () {
        it('should convert 24 hour to am value', function () {
            var d = datetime.parseDate('00:47');
            expect(datetime.getValueFromFormat(d, 'hh')).toEqual(0);
            expect(datetime.getValueFromFormat(d, 'h')).toEqual(0);
            var d = datetime.parseDate('11:47');
            expect(datetime.getValueFromFormat(d, 'hh')).toEqual(11);
            expect(datetime.getValueFromFormat(d, 'h')).toEqual(11);
        });
        it('should convert 24 hour to pm value', function () {
            var d = datetime.parseDate('12:47');
            expect(datetime.getValueFromFormat(d, 'hh')).toEqual(12);
            expect(datetime.getValueFromFormat(d, 'h')).toEqual(12);
            var d = datetime.parseDate('13:47');
            expect(datetime.getValueFromFormat(d, 'hh')).toEqual(1);
            expect(datetime.getValueFromFormat(d, 'h')).toEqual(1);
        });
        it('should convert am hours to am value', function () {
            var d = datetime.parseDate('00:47');
            expect(datetime.getValueFromFormat(d, 'A')).toEqual('am');
            expect(datetime.getValueFromFormat(d, 'a')).toEqual('am');
            var d = datetime.parseDate('11:47');
            expect(datetime.getValueFromFormat(d, 'A')).toEqual('am');
            expect(datetime.getValueFromFormat(d, 'a')).toEqual('am');
        });
        it('should convert pm hours to pm value', function () {
            var d = datetime.parseDate('12:47');
            expect(datetime.getValueFromFormat(d, 'A')).toEqual('pm');
            expect(datetime.getValueFromFormat(d, 'a')).toEqual('pm');
            var d = datetime.parseDate('23:47');
            expect(datetime.getValueFromFormat(d, 'A')).toEqual('pm');
            expect(datetime.getValueFromFormat(d, 'a')).toEqual('pm');
        });
        it('should convert date formats to values', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.getValueFromFormat(d, 'YYYY')).toEqual(1994);
            expect(datetime.getValueFromFormat(d, 'M')).toEqual(12);
            expect(datetime.getValueFromFormat(d, 'DDDD')).toEqual(15);
        });
    });
    describe('parseTemplate', function () {
        it('should not parse D thats apart of a word', function () {
            var formats = datetime.parseTemplate('D Days');
            expect(formats.length).toEqual(1);
            expect(formats[0]).toEqual('D');
        });
        it('should not parse D thats apart of a word', function () {
            var formats = datetime.parseTemplate('DD Days');
            expect(formats.length).toEqual(1);
            expect(formats[0]).toEqual('DD');
        });
        it('should not parse m thats apart of a word', function () {
            var formats = datetime.parseTemplate('m mins');
            expect(formats.length).toEqual(1);
            expect(formats[0]).toEqual('m');
        });
        it('should not parse M thats apart of a word', function () {
            var formats = datetime.parseTemplate('mm Minutes');
            expect(formats.length).toEqual(1);
            expect(formats[0]).toEqual('mm');
        });
        it('should not pickup "a" within 12-hour, but its not the am/pm', function () {
            var formats = datetime.parseTemplate('hh:mm is a time');
            expect(formats.length).toEqual(2);
            expect(formats[0]).toEqual('hh');
            expect(formats[1]).toEqual('mm');
        });
        it('should allow am/pm when using 12-hour and no spaces', function () {
            var formats = datetime.parseTemplate('hh:mma');
            expect(formats.length).toEqual(3);
            expect(formats[0]).toEqual('hh');
            expect(formats[1]).toEqual('mm');
            expect(formats[2]).toEqual('a');
        });
        it('should allow am/pm when using 12-hour', function () {
            var formats = datetime.parseTemplate('hh:mm a');
            expect(formats.length).toEqual(3);
            expect(formats[0]).toEqual('hh');
            expect(formats[1]).toEqual('mm');
            expect(formats[2]).toEqual('a');
        });
        it('should not add am/pm when not using 24-hour', function () {
            var formats = datetime.parseTemplate('HH:mm a');
            expect(formats.length).toEqual(2);
            expect(formats[0]).toEqual('HH');
            expect(formats[1]).toEqual('mm');
        });
        it('should get formats from template "m mm h hh H HH D DD DDD DDDD M MM MMM MMMM YY YYYY"', function () {
            var formats = datetime.parseTemplate('m mm h hh H HH D DD DDD DDDD M MM MMM MMMM YY YYYY');
            expect(formats[0]).toEqual('m');
            expect(formats[1]).toEqual('mm');
            expect(formats[2]).toEqual('h');
            expect(formats[3]).toEqual('hh');
            expect(formats[4]).toEqual('H');
            expect(formats[5]).toEqual('HH');
            expect(formats[6]).toEqual('D');
            expect(formats[7]).toEqual('DD');
            expect(formats[8]).toEqual('DDD');
            expect(formats[9]).toEqual('DDDD');
            expect(formats[10]).toEqual('M');
            expect(formats[11]).toEqual('MM');
            expect(formats[12]).toEqual('MMM');
            expect(formats[13]).toEqual('MMMM');
            expect(formats[14]).toEqual('YY');
            expect(formats[15]).toEqual('YYYY');
        });
        it('should get formats from template YYMMMMDDHHmm', function () {
            var formats = datetime.parseTemplate('YYMMMMDDHHmm');
            expect(formats[0]).toEqual('YY');
            expect(formats[1]).toEqual('MMMM');
            expect(formats[2]).toEqual('DD');
            expect(formats[3]).toEqual('HH');
            expect(formats[4]).toEqual('mm');
        });
        it('should get formats from template MM/DD/YYYY', function () {
            var formats = datetime.parseTemplate('MM/DD/YYYY');
            expect(formats[0]).toEqual('MM');
            expect(formats[1]).toEqual('DD');
            expect(formats[2]).toEqual('YYYY');
        });
    });
    describe('renderDateTime', function () {
        it('should show correct month and day name defaults', function () {
            var d = datetime.parseDate('2016-05-12');
            var r = datetime.renderDateTime('DDDD MMM D YYYY', d, {});
            expect(r).toEqual('Thursday May 12 2016');
        });
        it('should format h:mm a, PM', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('h:mm a', d, {})).toEqual('1:47 pm');
        });
        it('should get empty text for format without data', function () {
            var emptyObj = {};
            expect(datetime.renderDateTime('MMMM D, YYYY h:mm a', emptyObj, {})).toEqual('');
            var dataWithNulls = {
                year: null,
                month: null,
                day: null,
                hour: null,
                minute: null,
                second: null,
                millisecond: null,
                tzOffset: 0,
            };
            expect(datetime.renderDateTime('MMMM D, YYYY h:mm a', dataWithNulls, {})).toEqual('');
        });
        it('should format h:mm a, AM', function () {
            var d = datetime.parseDate('1994-12-15T00:47:20.789Z');
            expect(datetime.renderDateTime('h:mm a', d, {})).toEqual('12:47 am');
        });
        it('should format HH:mm', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('HH:mm', d, {})).toEqual('13:47');
        });
        it('should format MMMM D, YYYY', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('MMMM D, YYYY', d, {})).toEqual('December 15, 1994');
        });
        it('should format MM/DD/YYYY', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('MM/DD/YYYY', d, {})).toEqual('12/15/1994');
        });
        it('should format DD-MM-YY', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('DD-MM-YY', d, {})).toEqual('15-12-94');
        });
        it('should format YYYY', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('DD-MM-YY', d, {})).toEqual('15-12-94');
        });
        it('should format YYYY$MM.DD*HH?mm', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('YYYY$MM.DD*HH?mm', d, {})).toEqual('1994$12.15*13?47');
        });
        it('should return empty when template invalid', function () {
            var d = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(datetime.renderDateTime('', d, {})).toEqual('');
        });
        it('should return empty when date invalid', function () {
            var d = datetime.parseDate(null);
            expect(datetime.renderDateTime('YYYY', d, {})).toEqual('');
        });
    });
    describe('renderTextFormat', function () {
        it('should return a', function () {
            var d = datetime.parseDate('00:47');
            expect(datetime.renderTextFormat('a', 'am', d, {})).toEqual('am');
            expect(datetime.renderTextFormat('a', 'am', null, {})).toEqual('am');
            var d = datetime.parseDate('11:47');
            expect(datetime.renderTextFormat('a', 'am', d, {})).toEqual('am');
            expect(datetime.renderTextFormat('a', 'am', null, {})).toEqual('am');
            var d = datetime.parseDate('12:47');
            expect(datetime.renderTextFormat('a', 'pm', d, {})).toEqual('pm');
            expect(datetime.renderTextFormat('a', 'pm', null, {})).toEqual('pm');
        });
        it('should return A', function () {
            var d = datetime.parseDate('00:47');
            expect(datetime.renderTextFormat('A', 'am', d, {})).toEqual('AM');
            expect(datetime.renderTextFormat('A', 'am', null, {})).toEqual('AM');
            var d = datetime.parseDate('11:47');
            expect(datetime.renderTextFormat('A', 'am', d, {})).toEqual('AM');
            expect(datetime.renderTextFormat('A', 'am', null, {})).toEqual('AM');
            var d = datetime.parseDate('12:47');
            expect(datetime.renderTextFormat('A', 'pm', d, {})).toEqual('PM');
            expect(datetime.renderTextFormat('A', 'pm', null, {})).toEqual('PM');
        });
        it('should return m', function () {
            expect(datetime.renderTextFormat('m', 1, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('m', 12, null, {})).toEqual('12');
        });
        it('should return mm', function () {
            expect(datetime.renderTextFormat('mm', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('mm', 12, null, {})).toEqual('12');
        });
        it('should return hh', function () {
            expect(datetime.renderTextFormat('hh', 0, null, {})).toEqual('12');
            expect(datetime.renderTextFormat('hh', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('hh', 11, null, {})).toEqual('11');
            expect(datetime.renderTextFormat('hh', 12, null, {})).toEqual('12');
            expect(datetime.renderTextFormat('hh', 13, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('hh', 21, null, {})).toEqual('09');
            expect(datetime.renderTextFormat('hh', 23, null, {})).toEqual('11');
        });
        it('should return h', function () {
            expect(datetime.renderTextFormat('h', 0, null, {})).toEqual('12');
            expect(datetime.renderTextFormat('h', 1, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('h', 11, null, {})).toEqual('11');
            expect(datetime.renderTextFormat('h', 12, null, {})).toEqual('12');
            expect(datetime.renderTextFormat('h', 13, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('h', 21, null, {})).toEqual('9');
            expect(datetime.renderTextFormat('h', 23, null, {})).toEqual('11');
        });
        it('should return hh', function () {
            expect(datetime.renderTextFormat('hh', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('hh', 12, null, {})).toEqual('12');
        });
        it('should return H', function () {
            expect(datetime.renderTextFormat('H', 1, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('H', 12, null, {})).toEqual('12');
        });
        it('should return HH', function () {
            expect(datetime.renderTextFormat('HH', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('HH', 12, null, {})).toEqual('12');
        });
        it('should return D', function () {
            expect(datetime.renderTextFormat('D', 1, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('D', 12, null, {})).toEqual('12');
        });
        it('should return DD', function () {
            expect(datetime.renderTextFormat('DD', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('DD', 12, null, {})).toEqual('12');
        });
        it('should return DDD', function () {
            var d = {
                year: 2016,
                month: 5,
                day: 12,
            };
            expect(datetime.renderTextFormat('DDD', null, d, {})).toEqual('Thu');
        });
        it('should return DDD with custom locale', function () {
            var d = {
                year: 2016,
                month: 5,
                day: 12,
            };
            expect(datetime.renderTextFormat('DDD', null, d, customLocale)).toEqual('qui');
        });
        it('should return DDDD', function () {
            var d = {
                year: 2016,
                month: 5,
                day: 12,
            };
            expect(datetime.renderTextFormat('DDDD', null, d, {})).toEqual('Thursday');
        });
        it('should return DDDD with custom locale', function () {
            var d = {
                year: 2016,
                month: 5,
                day: 12,
            };
            expect(datetime.renderTextFormat('DDDD', null, d, customLocale)).toEqual('quinta-feira');
        });
        it('should return M', function () {
            expect(datetime.renderTextFormat('M', 1, null, {})).toEqual('1');
            expect(datetime.renderTextFormat('M', 12, null, {})).toEqual('12');
        });
        it('should return MM', function () {
            expect(datetime.renderTextFormat('MM', 1, null, {})).toEqual('01');
            expect(datetime.renderTextFormat('MM', 12, null, {})).toEqual('12');
        });
        it('should return MMM', function () {
            expect(datetime.renderTextFormat('MMM', 1, null, {})).toEqual('Jan');
            expect(datetime.renderTextFormat('MMM', 12, null, {})).toEqual('Dec');
        });
        it('should return MMM with custom locale', function () {
            expect(datetime.renderTextFormat('MMM', 1, null, customLocale)).toEqual('jan');
        });
        it('should return MMMM', function () {
            expect(datetime.renderTextFormat('MMMM', 1, null, {})).toEqual('January');
            expect(datetime.renderTextFormat('MMMM', 12, null, {})).toEqual('December');
        });
        it('should return MMMM with custom locale', function () {
            expect(datetime.renderTextFormat('MMMM', 1, null, customLocale)).toEqual('janeiro');
        });
        it('should return YY', function () {
            expect(datetime.renderTextFormat('YY', 1994, null, {})).toEqual('94');
            expect(datetime.renderTextFormat('YY', 94, null, {})).toEqual('94');
        });
        it('should return YYYY', function () {
            expect(datetime.renderTextFormat('YYYY', 1994, null, {})).toEqual('1994');
            expect(datetime.renderTextFormat('YYYY', 0, null, {})).toEqual('0000');
        });
        it('should return empty when blank', function () {
            expect(datetime.renderTextFormat(null, null, null, {})).toEqual('');
            expect(datetime.renderTextFormat(null, 1994, null, {})).toEqual('1994');
        });
    });
    describe('parseISODate', function () {
        it('should get HH:MM:SS.SSS+HH:MM', function () {
            var parsed = datetime.parseDate('13:47:20.789+05:30');
            expect(parsed.year).toEqual(null);
            expect(parsed.month).toEqual(null);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(330);
        });
        it('should get HH:MM:SS.SSS', function () {
            var parsed = datetime.parseDate('13:47:20.789');
            expect(parsed.year).toEqual(null);
            expect(parsed.month).toEqual(null);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get HH:MM:SS', function () {
            var parsed = datetime.parseDate('13:47:20');
            expect(parsed.year).toEqual(null);
            expect(parsed.month).toEqual(null);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get HH:MM', function () {
            var parsed = datetime.parseDate('13:47');
            expect(parsed.year).toEqual(null);
            expect(parsed.month).toEqual(null);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(null);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get YYYY-MM-DDTHH:MM:SS.SSS+HH:MM', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47:20.789+05:30');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(330);
        });
        it('should get YYYY-MM-DDTHH:MM:SS.SSS-HH:MM', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47:20.789-11:45');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(-705);
        });
        it('should get YYYY-MM-DDTHH:MM:SS.SSS-HH', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47:20.789-02');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(-120);
        });
        it('should get YYYY-MM-DDTHH:MM:SS.SSSZ and set UTC offset', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47:20.789Z');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(789);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get YYYY-MM-DDTHH:MM:SS', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47:20');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(20);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get YYYY-MM-DDTHH:MM', function () {
            var parsed = datetime.parseDate('1994-12-15T13:47');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(13);
            expect(parsed.minute).toEqual(47);
            expect(parsed.second).toEqual(null);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should NOT work with YYYY-MM-DDTHH', function () {
            var parsed = datetime.parseDate('1994-12-15T13');
            expect(parsed).toEqual(null);
        });
        it('should get YYYY-MM-DD', function () {
            var parsed = datetime.parseDate('1994-12-15');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(15);
            expect(parsed.hour).toEqual(null);
            expect(parsed.minute).toEqual(null);
            expect(parsed.second).toEqual(null);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get YYYY-MM', function () {
            var parsed = datetime.parseDate('1994-12');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(12);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(null);
            expect(parsed.minute).toEqual(null);
            expect(parsed.second).toEqual(null);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should get YYYY', function () {
            var parsed = datetime.parseDate('1994');
            expect(parsed.year).toEqual(1994);
            expect(parsed.month).toEqual(null);
            expect(parsed.day).toEqual(null);
            expect(parsed.hour).toEqual(null);
            expect(parsed.minute).toEqual(null);
            expect(parsed.second).toEqual(null);
            expect(parsed.millisecond).toEqual(null);
            expect(parsed.tzOffset).toEqual(0);
        });
        it('should handle bad date formats', function () {
            var parsed = datetime.parseDate('12/15/1994');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('12-15-1994');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('1994-1994');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('1994 12 15');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('12.15.1994');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('12\\15\\1994');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('200');
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('holla');
            expect(parsed).toEqual(null);
        });
        it('should get nothing with null date', function () {
            var parsed = datetime.parseDate(null);
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate(undefined);
            expect(parsed).toEqual(null);
            var parsed = datetime.parseDate('');
            expect(parsed).toEqual(null);
        });
    });
    // pt-br
    var customLocale = {
        dayNames: [
            'domingo',
            'segunda-feira',
            'ter\u00e7a-feira',
            'quarta-feira',
            'quinta-feira',
            'sexta-feira',
            's\u00e1bado'
        ],
        dayShortNames: [
            'dom',
            'seg',
            'ter',
            'qua',
            'qui',
            'sex',
            's\u00e1b'
        ],
        monthNames: [
            'janeiro',
            'fevereiro',
            'mar\u00e7o',
            'abril',
            'maio',
            'junho',
            'julho',
            'agosto',
            'setembro',
            'outubro',
            'novembro',
            'dezembro'
        ],
        monthShortNames: [
            'jan',
            'fev',
            'mar',
            'abr',
            'mai',
            'jun',
            'jul',
            'ago',
            'set',
            'out',
            'nov',
            'dez'
        ],
    };
}
exports.run = run;