diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b47d09..88162c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ Changelog ========= + +### 2.17.0 [Also available here](https://gist.github.com/ichernev/ed58f76fb95205eeac653d719972b90c) +* Release Nov 22, 2016 + +* [#3435](https://github.com/moment/moment/pull/3435) [new locale] yo: Yoruba (Nigeria) locale +* [#3595](https://github.com/moment/moment/pull/3595) [bugfix] Fix accidental reference to global "value" variable +* [#3506](https://github.com/moment/moment/pull/3506) [bugfix] Fix invalid moments returning valid dates to method calls +* [#3563](https://github.com/moment/moment/pull/3563) [locale] ca: Change future relative time +* [#3504](https://github.com/moment/moment/pull/3504) [tests] Fixes [#3463](https://github.com/moment/moment/issues/3463), parseZone not handling Z correctly (tests only) +* [#3591](https://github.com/moment/moment/pull/3591) [misc] typescript: update typescript to 2.0.8, add strictNullChecks=true +* [#3597](https://github.com/moment/moment/pull/3597) [misc] Fixed capitalization in nuget spec ### 2.16.0 [See full changelog](https://gist.github.com/ichernev/17bffc1005a032cb1a8ac4c1558b4994) * Release Nov 9, 2016 diff --git a/Moment.js.nuspec b/Moment.js.nuspec index c5943f0..77b9793 100644 --- a/Moment.js.nuspec +++ b/Moment.js.nuspec @@ -2,15 +2,13 @@ Moment.js - 2.16.0 + 2.17.0 Tim Wood, Iskren Chernev, Moment.js contributors Cory Deppen, Iskren Chernev - A lightweight javascript date library for parsing, manipulating, and formatting dates. + A lightweight JavaScript date library for parsing, manipulating, and formatting dates. - * Release Nov 9, 2016 -- full changelog https://gist.github.com/ichernev/17bffc1005a032cb1a8ac4c1558b4994 - * [3515] [feature] Default to current week (fixes #2300) - * [3546] [bugfix] lazy loading of locales - * [3523] [3581] Fix multiple issue in parseZone + * Release Nov 22, 2016 -- full changelog https://gist.github.com/ichernev/ed58f76fb95205eeac653d719972b90c + * [#3591](https://github.com/moment/moment/pull/3591) [misc] typescript: update typescript to 2.0.8, add strictNullChecks=true http://momentjs.com/ http://pbs.twimg.com/profile_images/482670411402858496/Xrtdc94q_normal.png diff --git a/component.json b/component.json index 8e405ee..4ad07b1 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "moment", - "version": "2.16.0", + "version": "2.17.0", "main": "moment.js", "description": "Parse, validate, manipulate, and display dates in JavaScript.", "files": [ @@ -110,6 +110,7 @@ "locale/uz.js", "locale/vi.js", "locale/x-pseudo.js", + "locale/yo.js", "locale/zh-cn.js", "locale/zh-hk.js", "locale/zh-tw.js" diff --git a/locale/ca.js b/locale/ca.js index 454e361..3a4c62f 100644 --- a/locale/ca.js +++ b/locale/ca.js @@ -45,7 +45,7 @@ sameElse : 'L' }, relativeTime : { - future : 'en %s', + future : 'd\'aquí %s', past : 'fa %s', s : 'uns segons', m : 'un minut', diff --git a/locale/yo.js b/locale/yo.js new file mode 100644 index 0000000..e68b1e1 --- /dev/null +++ b/locale/yo.js @@ -0,0 +1,60 @@ +//! moment.js locale configuration +//! locale : Yoruba Nigeria (yo) +//! author : Atolagbe Abisoye : https://github.com/andela-batolagbe + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + +var yo = moment.defineLocale('yo', { + months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), + monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat : { + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' + }, + calendar : { + sameDay : '[Ònì ni] LT', + nextDay : '[Ọ̀la ni] LT', + nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', + lastDay : '[Àna ni] LT', + lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'ní %s', + past : '%s kọjá', + s : 'ìsẹjú aayá die', + m : 'ìsẹjú kan', + mm : 'ìsẹjú %d', + h : 'wákati kan', + hh : 'wákati %d', + d : 'ọjọ́ kan', + dd : 'ọjọ́ %d', + M : 'osù kan', + MM : 'osù %d', + y : 'ọdún kan', + yy : 'ọdún %d' + }, + ordinalParse : /ọjọ́\s\d{1,2}/, + ordinal : 'ọjọ́ %d', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } +}); + +return yo; + +}))); diff --git a/meteor/package.js b/meteor/package.js index f26acd0..efe719d 100644 --- a/meteor/package.js +++ b/meteor/package.js @@ -6,7 +6,7 @@ Package.describe({ name: packageName, summary: 'Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging', - version: '2.16.0', + version: '2.17.0', git: 'https://github.com/moment/moment.git' }); diff --git a/min/locales.js b/min/locales.js index d09eb43..1f2eac0 100644 --- a/min/locales.js +++ b/min/locales.js @@ -1336,7 +1336,7 @@ sameElse : 'L' }, relativeTime : { - future : 'en %s', + future : 'd\'aquí %s', past : 'fa %s', s : 'uns segons', m : 'un minut', @@ -8270,6 +8270,55 @@ }); //! moment.js locale configuration +//! locale : Yoruba Nigeria (yo) +//! author : Atolagbe Abisoye : https://github.com/andela-batolagbe + +moment.defineLocale('yo', { + months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), + monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat : { + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' + }, + calendar : { + sameDay : '[Ònì ni] LT', + nextDay : '[Ọ̀la ni] LT', + nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', + lastDay : '[Àna ni] LT', + lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'ní %s', + past : '%s kọjá', + s : 'ìsẹjú aayá die', + m : 'ìsẹjú kan', + mm : 'ìsẹjú %d', + h : 'wákati kan', + hh : 'wákati %d', + d : 'ọjọ́ kan', + dd : 'ọjọ́ %d', + M : 'osù kan', + MM : 'osù %d', + y : 'ọdún kan', + yy : 'ọdún %d' + }, + ordinalParse : /ọjọ́\s\d{1,2}/, + ordinal : 'ọjọ́ %d', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } +}); + +//! moment.js locale configuration //! locale : Chinese (China) [zh-cn] //! author : suupic : https://github.com/suupic //! author : Zeno Zeng : https://github.com/zenozeng diff --git a/min/moment-with-locales.js b/min/moment-with-locales.js index 8da001b..fda4d1a 100644 --- a/min/moment-with-locales.js +++ b/min/moment-with-locales.js @@ -36,7 +36,7 @@ } function isNumber(input) { - return typeof value === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } function isDate(input) { @@ -228,6 +228,9 @@ function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { @@ -4255,12 +4258,12 @@ // Side effect imports //! moment.js -//! version : 2.16.0 +//! version : 2.17.0 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com -hooks.version = '2.16.0'; +hooks.version = '2.17.0'; setHookCallback(createLocal); @@ -5623,7 +5626,7 @@ sameElse : 'L' }, relativeTime : { - future : 'en %s', + future : 'd\'aquí %s', past : 'fa %s', s : 'uns segons', m : 'un minut', @@ -12553,6 +12556,55 @@ }); //! moment.js locale configuration +//! locale : Yoruba Nigeria (yo) +//! author : Atolagbe Abisoye : https://github.com/andela-batolagbe + +hooks.defineLocale('yo', { + months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), + monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat : { + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' + }, + calendar : { + sameDay : '[Ònì ni] LT', + nextDay : '[Ọ̀la ni] LT', + nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', + lastDay : '[Àna ni] LT', + lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'ní %s', + past : '%s kọjá', + s : 'ìsẹjú aayá die', + m : 'ìsẹjú kan', + mm : 'ìsẹjú %d', + h : 'wákati kan', + hh : 'wákati %d', + d : 'ọjọ́ kan', + dd : 'ọjọ́ %d', + M : 'osù kan', + MM : 'osù %d', + y : 'ọdún kan', + yy : 'ọdún %d' + }, + ordinalParse : /ọjọ́\s\d{1,2}/, + ordinal : 'ọjọ́ %d', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } +}); + +//! moment.js locale configuration //! locale : Chinese (China) [zh-cn] //! author : suupic : https://github.com/suupic //! author : Zeno Zeng : https://github.com/zenozeng diff --git a/min/tests.js b/min/tests.js index 3e2a937..0c98b27 100644 --- a/min/tests.js +++ b/min/tests.js @@ -7119,7 +7119,7 @@ }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'en uns segons', 'prefix'); + assert.equal(moment(30000).from(0), 'd\'aquí uns segons', 'prefix'); assert.equal(moment(0).from(30000), 'fa uns segons', 'suffix'); }); @@ -7128,8 +7128,8 @@ }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'en uns segons', 'en uns segons'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 dies', 'en 5 dies'); + assert.equal(moment().add({s: 30}).fromNow(), 'd\'aquí uns segons', 'd\'aquí uns segons'); + assert.equal(moment().add({d: 5}).fromNow(), 'd\'aquí 5 dies', 'd\'aquí 5 dies'); }); test('calendar day', function (assert) { @@ -49671,6 +49671,468 @@ assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); +}); + +}))); + + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../../moment')) : + typeof define === 'function' && define.amd ? define(['../../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + +function each(array, callback) { + var i; + for (i = 0; i < array.length; i++) { + callback(array[i], i, array); + } +} + +function objectKeys(obj) { + if (Object.keys) { + return Object.keys(obj); + } else { + // IE8 + var res = [], i; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(i); + } + } + return res; + } +} + +// Pick the first defined of two or three arguments. + +function defineCommonLocaleTests(locale, options) { + test('lenient ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient ordinal parsing ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient ordinal parsing ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient ordinal parsing ' + i + ' date check'); + } + }); + + test('lenient ordinal parsing of number', function (assert) { + var i, testMoment; + for (i = 1; i <= 31; ++i) { + testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); + assert.equal(testMoment.year(), 2014, + 'lenient ordinal parsing of number ' + i + ' year check'); + assert.equal(testMoment.month(), 0, + 'lenient ordinal parsing of number ' + i + ' month check'); + assert.equal(testMoment.date(), i, + 'lenient ordinal parsing of number ' + i + ' date check'); + } + }); + + test('strict ordinal parsing', function (assert) { + var i, ordinalStr, testMoment; + for (i = 1; i <= 31; ++i) { + ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); + testMoment = moment(ordinalStr, 'YYYY MM Do', true); + assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); + } + }); + + test('meridiem invariant', function (assert) { + var h, m, t1, t2; + for (h = 0; h < 24; ++h) { + for (m = 0; m < 60; m += 15) { + t1 = moment.utc([2000, 0, 1, h, m]); + t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); + assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), + 'meridiem at ' + t1.format('HH:mm')); + } + } + }); + + test('date format correctness', function (assert) { + var data, tokens; + data = moment.localeData()._longDateFormat; + tokens = objectKeys(data); + each(tokens, function (srchToken) { + // Check each format string to make sure it does not contain any + // tokens that need to be expanded. + each(tokens, function (baseToken) { + // strip escaped sequences + var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); + assert.equal(false, !!~format.indexOf(srchToken), + 'contains ' + srchToken + ' in ' + baseToken); + }); + }); + }); + + test('month parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr') { + // I can't fix it :( + expect(0); + return; + } + function tester(format) { + var r; + r = moment(m.format(format), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); + + r = moment(m.format(format), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); + } + + for (i = 0; i < 12; ++i) { + m = moment([2015, i, 15, 18]); + tester('MMM'); + tester('MMM.'); + tester('MMMM'); + tester('MMMM.'); + } + }); + + test('weekday parsing correctness', function (assert) { + var i, m; + + if (locale === 'tr' || locale === 'az' || locale === 'ro') { + // tr, az: There is a lower-case letter (ı), that converted to + // upper then lower changes to i + // ro: there is the letter ț which behaves weird under IE8 + expect(0); + return; + } + function tester(format) { + var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format + ' ' + m.toISOString(); + r = moment(m.format(format), format); + assert.equal(r.weekday(), m.weekday(), baseMsg); + r = moment(m.format(format).toLocaleUpperCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); + r = moment(m.format(format).toLocaleLowerCase(), format); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); + + r = moment(m.format(format), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); + r = moment(m.format(format).toLocaleUpperCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); + r = moment(m.format(format).toLocaleLowerCase(), format, true); + assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); + } + + for (i = 0; i < 7; ++i) { + m = moment.utc([2015, 0, i + 1, 18]); + tester('dd'); + tester('ddd'); + tester('dddd'); + } + }); +} + +function setupDeprecationHandler(test, moment$$1, scope) { + test._expectedDeprecations = null; + test._observedDeprecations = null; + test._oldSupress = moment$$1.suppressDeprecationWarnings; + moment$$1.suppressDeprecationWarnings = true; + test.expectedDeprecations = function () { + test._expectedDeprecations = arguments; + test._observedDeprecations = []; + }; + moment$$1.deprecationHandler = function (name, msg) { + var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); + if (deprecationId === -1) { + throw new Error('Unexpected deprecation thrown name=' + + name + ' msg=' + msg); + } + test._observedDeprecations[deprecationId] = 1; + }; +} + +function teardownDeprecationHandler(test, moment$$1, scope) { + moment$$1.suppressDeprecationWarnings = test._oldSupress; + + if (test._expectedDeprecations != null) { + var missedDeprecations = []; + each(test._expectedDeprecations, function (deprecationPattern, id) { + if (test._observedDeprecations[id] !== 1) { + missedDeprecations.push(deprecationPattern); + } + }); + if (missedDeprecations.length !== 0) { + throw new Error('Expected deprecation warnings did not happen: ' + + missedDeprecations.join(' ')); + } + } +} + +function matchedDeprecation(name, msg, deprecations) { + if (deprecations == null) { + return -1; + } + for (var i = 0; i < deprecations.length; ++i) { + if (name != null && name === deprecations[i]) { + return i; + } + if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { + return i; + } + } + return -1; +} + +/*global QUnit:false*/ + +var test = QUnit.test; + +var expect = QUnit.expect; + + + +function localeModule (name, lifecycle) { + QUnit.module('locale:' + name, { + setup : function () { + moment.locale(name); + moment.createFromInputFallback = function (config) { + throw new Error('input not handled by moment: ' + config._i); + }; + setupDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.setup) { + lifecycle.setup(); + } + }, + teardown : function () { + moment.locale('en'); + teardownDeprecationHandler(test, moment, 'locale'); + if (lifecycle && lifecycle.teardown) { + lifecycle.teardown(); + } + } + }); + defineCommonLocaleTests(name, -1, -1); +} + +localeModule('yo'); + +test('parse', function (assert) { + var tests = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.split('_'), i; + function equalTest(input, mmm, i) { + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + } + for (i = 0; i < 12; i++) { + tests[i] = tests[i].split(' '); + equalTest(tests[i][0], 'MMM', i); + equalTest(tests[i][1], 'MMM', i); + equalTest(tests[i][0], 'MMMM', i); + equalTest(tests[i][1], 'MMMM', i); + equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); + } +}); + +test('format', function (assert) { + var a = [ + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Àìkú, Èrèlè ọjọ́ 14 2010, 3:25:50 pm'], + ['ddd, hA', 'Àìk, 3PM'], + ['M Mo MM MMMM MMM', '2 ọjọ́ 2 02 Èrèlè Èrl'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 ọjọ́ 14 14'], + ['d do dddd ddd dd', '0 ọjọ́ 0 Àìkú Àìk Àì'], + ['DDD DDDo DDDD', '45 ọjọ́ 45 045'], + ['w wo ww', '6 ọjọ́ 6 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the ọjọ́ 45 day of the year'], + ['LTS', '3:25:50 PM'], + ['L', '14/02/2010'], + ['LL', '14 Èrèlè 2010'], + ['LLL', '14 Èrèlè 2010 3:25 PM'], + ['LLLL', 'Àìkú, 14 Èrèlè 2010 3:25 PM'], + ['l', '14/2/2010'], + ['ll', '14 Èrl 2010'], + ['lll', '14 Èrl 2010 3:25 PM'], + ['llll', 'Àìk, 14 Èrl 2010 3:25 PM'] + ], + b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), + i; + for (i = 0; i < a.length; i++) { + assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); + } +}); + +test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), 'ọjọ́ 1', 'ọjọ́ 1'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ọjọ́ 2', 'ọjọ́ 2'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ọjọ́ 3', 'ọjọ́ 3'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ọjọ́ 4', 'ọjọ́ 4'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ọjọ́ 5', 'ọjọ́ 5'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ọjọ́ 6', 'ọjọ́ 6'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ọjọ́ 7', 'ọjọ́ 7'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ọjọ́ 8', 'ọjọ́ 8'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ọjọ́ 9', 'ọjọ́ 9'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ọjọ́ 10', 'ọjọ́ 10'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ọjọ́ 11', 'ọjọ́ 11'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ọjọ́ 12', 'ọjọ́ 12'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ọjọ́ 13', 'ọjọ́ 13'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ọjọ́ 14', 'ọjọ́ 14'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ọjọ́ 15', 'ọjọ́ 15'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ọjọ́ 16', 'ọjọ́ 16'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ọjọ́ 17', 'ọjọ́ 17'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ọjọ́ 18', 'ọjọ́ 18'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ọjọ́ 19', 'ọjọ́ 19'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ọjọ́ 20', 'ọjọ́ 20'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ọjọ́ 21', 'ọjọ́ 21'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ọjọ́ 22', 'ọjọ́ 22'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ọjọ́ 23', 'ọjọ́ 23'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ọjọ́ 24', 'ọjọ́ 24'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ọjọ́ 25', 'ọjọ́ 25'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ọjọ́ 26', 'ọjọ́ 26'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ọjọ́ 27', 'ọjọ́ 27'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ọjọ́ 28', 'ọjọ́ 28'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ọjọ́ 29', 'ọjọ́ 29'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ọjọ́ 30', 'ọjọ́ 30'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ọjọ́ 31', 'ọjọ́ 31'); +}); + +test('format month', function (assert) { + var expected = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.split('_'), + i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); + } +}); + +test('format week', function (assert) { + var expected = 'Àìkú Àìk Àì_Ajé Ajé Aj_Ìsẹ́gun Ìsẹ́ Ìs_Ọjọ́rú Ọjr Ọr_Ọjọ́bọ Ọjb Ọb_Ẹtì Ẹtì Ẹt_Àbámẹ́ta Àbá Àb'.split('_'), + i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + } +}); + +test('from', function (assert) { + var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ìsẹjú aayá die', '44 seconds = ìsẹjú aayá die'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ìsẹjú kan', '45 seconds = ìsẹjú kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ìsẹjú kan', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'ìsẹjú 2', '90 seconds = ìsẹjú 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'ìsẹjú 44', 'ìsẹjú 44 = ìsẹjú 44'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wákati kan', 'ìsẹjú 45 = wákati kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wákati kan', 'ìsẹjú 89 = wákati kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'wákati 2', 'ìsẹjú 90 = wákati 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'wákati 5', 'wákati 5 = wákati 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'wákati 21', 'wákati 21 = wákati 21'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ọjọ́ kan', '22 wákati = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ọjọ́ kan', '35 wákati = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'ọjọ́ 2', 'wákati 36 = ọjọ́ 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ọjọ́ kan', '1 = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'ọjọ́ 5', 'ọjọ́ 5 = ọjọ́ 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'ọjọ́ 25', 'ọjọ́ 25 = ọjọ́ 25'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'osù kan', 'ọjọ́ 26 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'osù kan', 'ọjọ́ 30 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'osù kan', 'ọjọ́ 43 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'osù 2', 'ọjọ́ 46 = osù 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'osù 2', 'ọjọ́ 75 = osù 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'osù 3', 'ọjọ́ 76 = osù 3'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'osù kan', 'osù 1 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'osù 5', 'osù 5 = osù 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ọdún kan', 'ọjọ 345 = ọdún kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'ọdún 2', 'ọjọ 548 = ọdún 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ọdún kan', 'ọdún 1 = ọdún kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'ọdún 5', 'ọdún 5 = ọdún 5'); +}); + +test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'ní ìsẹjú aayá die', 'prefix'); + assert.equal(moment(0).from(30000), 'ìsẹjú aayá die kọjá', 'suffix'); +}); + +test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'ìsẹjú aayá die kọjá', 'now from now should display as in the past'); +}); + +test('fromNow', function (assert) { + assert.equal(moment().add({s: 30}).fromNow(), 'ní ìsẹjú aayá die', 'ní ìsẹjú aayá die'); + assert.equal(moment().add({d: 5}).fromNow(), 'ní ọjọ́ 5', 'ní ọjọ́ 5'); +}); + +test('calendar day', function (assert) { + var a = moment().hours(12).minutes(0).seconds(0); + + assert.equal(moment(a).calendar(), 'Ònì ni 12:00 PM', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Ònì ni 12:25 PM', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Ònì ni 1:00 PM', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Ọ̀la ni 12:00 PM', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ònì ni 11:00 AM', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Àna ni 12:00 PM', 'yesterday at the same time'); +}); + +test('calendar next week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days end of day'); + } +}); + +test('calendar last week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days end of day'); + } +}); + +test('calendar all else', function (assert) { + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + + weeksAgo = moment().subtract({w: 2}); + weeksFromNow = moment().add({w: 2}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); +}); + +test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 ọjọ́ 52', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 15 2012 should be week 2'); }); }))); @@ -53270,6 +53732,12 @@ assert.ok(moment('1/1/2016 extra data', ['a', 'M/D/YYYY']).isValid(), 'took second format, does not pick up on meridiem parsed from first format (good copy)'); }); +test('invalid dates return invalid for methods that access the _d prop', function (assert) { + var momentAsDate = moment(['2015', '12', '1']).toDate(); + assert.ok(momentAsDate instanceof Date, 'toDate returns a Date object'); + assert.ok(isNaN(momentAsDate.getTime()), 'toDate returns an invalid Date invalid'); +}); + }))); @@ -60645,7 +61113,7 @@ var expect = QUnit.expect; function isNumber(input) { - return typeof value === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } test('isNumber recognizes numbers', function (assert) { @@ -72435,12 +72903,30 @@ test('parse zone without a timezone', function (assert) { test.expectedDeprecations(); - var m = moment.parseZone('2016-02-01T00:00:00'); + var m1 = moment.parseZone('2016-02-01T00:00:00'); + var m2 = moment.parseZone('2016-02-01T00:00:00Z'); + var m3 = moment.parseZone('2016-02-01T00:00:00+00:00'); //Someone might argue this is not necessary, you could even argue that is wrong being here. + var m4 = moment.parseZone('2016-02-01T00:00:00+0000'); //Someone might argue this is not necessary, you could even argue that is wrong being here. assert.equal( - m.format('M D YYYY HH:mm:ss ZZ'), + m1.format('M D YYYY HH:mm:ss ZZ'), '2 1 2016 00:00:00 +0000', 'Not providing a timezone should keep the time and change the zone to 0' ); + assert.equal( + m2.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); + assert.equal( + m3.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); + assert.equal( + m4.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); }); }))); diff --git a/moment.d.ts b/moment.d.ts index 23048bb..01aa732 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -67,8 +67,8 @@ lastWeek?: CalendarSpecVal; sameElse?: CalendarSpecVal; - // any additonal properties might be used with moment.calendarFormat - [x: string]: CalendarSpecVal; + // any additional properties might be used with moment.calendarFormat + [x: string]: CalendarSpecVal | undefined; } type RelativeTimeSpecVal = ( @@ -248,12 +248,12 @@ overflow: number; charsLeftOver: number; nullInput: boolean; - invalidMonth: string; + invalidMonth: string | null; invalidFormat: boolean; userInvalidated: boolean; iso: boolean; parsedDateParts: any[]; - meridiem: string; + meridiem: string | null; } interface MomentParsingFlagsOpt { @@ -389,8 +389,8 @@ to: MomentInput; } - type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject; - type DurationInputArg1 = Duration | number | string | FromTo | DurationInputObject; + type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | null | undefined; + type DurationInputArg1 = Duration | number | string | FromTo | DurationInputObject | null | undefined; type DurationInputArg2 = unitOfTime.DurationConstructor; type LocaleSpecifier = string | Moment | Duration | string[]; @@ -632,11 +632,9 @@ export function locale(language?: string): string; export function locale(language?: string[]): string; - export function locale(language?: string, definition?: LocaleSpecification): string; + export function locale(language?: string, definition?: LocaleSpecification | null | undefined): string; export function localeData(key?: string | string[]): Locale; - - export function updateLocale(language: string, locale: LocaleSpecification): Locale; export function duration(inp?: DurationInputArg1, unit?: DurationInputArg2): Duration; @@ -686,8 +684,8 @@ */ export function now(): number; - export function defineLocale(language: string, localeSpec: LocaleSpecification): Locale; - export function updateLocale(language: string, localeSpec: LocaleSpecification): Locale; + export function defineLocale(language: string, localeSpec: LocaleSpecification | null): Locale; + export function updateLocale(language: string, localeSpec: LocaleSpecification | null): Locale; export function locales(): string[]; diff --git a/moment.js b/moment.js index 3046f1b..d897b8f 100644 --- a/moment.js +++ b/moment.js @@ -1,5 +1,5 @@ //! moment.js -//! version : 2.16.0 +//! version : 2.17.0 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com @@ -42,7 +42,7 @@ } function isNumber(input) { - return typeof value === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } function isDate(input) { @@ -234,6 +234,9 @@ function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { @@ -4261,7 +4264,7 @@ // Side effect imports -hooks.version = '2.16.0'; +hooks.version = '2.17.0'; setHookCallback(createLocal); diff --git a/package.json b/package.json index 4de694a..ef1c619 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moment", - "version": "2.16.0", + "version": "2.17.0", "description": "Parse, validate, manipulate, and display dates", "homepage": "http://momentjs.com", "author": "Iskren Ivov Chernev (https://github.com/ichernev)", @@ -65,7 +65,7 @@ "qunit-cli": "^0.1.4", "rollup": "latest", "spacejam": "latest", - "typescript": "^1.8.10", + "typescript": "^2.0.8", "coveralls": "^2.11.2", "nyc": "^2.1.4" }, diff --git a/src/lib/moment/constructor.js b/src/lib/moment/constructor.js index 964c0ae..83f83ef 100644 --- a/src/lib/moment/constructor.js +++ b/src/lib/moment/constructor.js @@ -60,6 +60,9 @@ export function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { diff --git a/src/lib/utils/is-number.js b/src/lib/utils/is-number.js index e34c783..74d6137 100644 --- a/src/lib/utils/is-number.js +++ b/src/lib/utils/is-number.js @@ -1,3 +1,3 @@ export default function isNumber(input) { - return typeof value === 'number' || Object.prototype.toString.call(input) === '[object Number]'; + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } diff --git a/src/locale/ca.js b/src/locale/ca.js index 7e9c570..17f50b5 100644 --- a/src/locale/ca.js +++ b/src/locale/ca.js @@ -39,7 +39,7 @@ sameElse : 'L' }, relativeTime : { - future : 'en %s', + future : 'd\'aquí %s', past : 'fa %s', s : 'uns segons', m : 'un minut', diff --git a/src/locale/yo.js b/src/locale/yo.js new file mode 100644 index 0000000..4ccb67a --- /dev/null +++ b/src/locale/yo.js @@ -0,0 +1,50 @@ +//! moment.js locale configuration +//! locale : Yoruba Nigeria (yo) +//! author : Atolagbe Abisoye : https://github.com/andela-batolagbe + +import moment from '../moment'; + +export default moment.defineLocale('yo', { + months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'), + monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat : { + LT : 'h:mm A', + LTS : 'h:mm:ss A', + L : 'DD/MM/YYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY h:mm A', + LLLL : 'dddd, D MMMM YYYY h:mm A' + }, + calendar : { + sameDay : '[Ònì ni] LT', + nextDay : '[Ọ̀la ni] LT', + nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', + lastDay : '[Àna ni] LT', + lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse : 'L' + }, + relativeTime : { + future : 'ní %s', + past : '%s kọjá', + s : 'ìsẹjú aayá die', + m : 'ìsẹjú kan', + mm : 'ìsẹjú %d', + h : 'wákati kan', + hh : 'wákati %d', + d : 'ọjọ́ kan', + dd : 'ọjọ́ %d', + M : 'osù kan', + MM : 'osù %d', + y : 'ọdún kan', + yy : 'ọdún %d' + }, + ordinalParse : /ọjọ́\s\d{1,2}/, + ordinal : 'ọjọ́ %d', + week : { + dow : 1, // Monday is the first day of the week. + doy : 4 // The week that contains Jan 4th is the first week of the year. + } +}); diff --git a/src/moment.js b/src/moment.js index f87e507..671b4dc 100644 --- a/src/moment.js +++ b/src/moment.js @@ -1,12 +1,12 @@ //! moment.js -//! version : 2.16.0 +//! version : 2.17.0 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com import { hooks as moment, setHookCallback } from './lib/utils/hooks'; -moment.version = '2.16.0'; +moment.version = '2.17.0'; import { min, diff --git a/src/test/locale/ca.js b/src/test/locale/ca.js index b769c82..cefe2e7 100644 --- a/src/test/locale/ca.js +++ b/src/test/locale/ca.js @@ -137,7 +137,7 @@ }); test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'en uns segons', 'prefix'); + assert.equal(moment(30000).from(0), 'd\'aquí uns segons', 'prefix'); assert.equal(moment(0).from(30000), 'fa uns segons', 'suffix'); }); @@ -146,8 +146,8 @@ }); test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'en uns segons', 'en uns segons'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 dies', 'en 5 dies'); + assert.equal(moment().add({s: 30}).fromNow(), 'd\'aquí uns segons', 'd\'aquí uns segons'); + assert.equal(moment().add({d: 5}).fromNow(), 'd\'aquí 5 dies', 'd\'aquí 5 dies'); }); test('calendar day', function (assert) { diff --git a/src/test/locale/yo.js b/src/test/locale/yo.js new file mode 100644 index 0000000..46bf1c2 --- /dev/null +++ b/src/test/locale/yo.js @@ -0,0 +1,212 @@ +import { localeModule, test } from '../qunit'; +import moment from '../../moment'; +localeModule('yo'); + +test('parse', function (assert) { + var tests = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.split('_'), i; + function equalTest(input, mmm, i) { + assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); + } + for (i = 0; i < 12; i++) { + tests[i] = tests[i].split(' '); + equalTest(tests[i][0], 'MMM', i); + equalTest(tests[i][1], 'MMM', i); + equalTest(tests[i][0], 'MMMM', i); + equalTest(tests[i][1], 'MMMM', i); + equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); + } +}); + +test('format', function (assert) { + var a = [ + ['dddd, MMMM Do YYYY, h:mm:ss a', 'Àìkú, Èrèlè ọjọ́ 14 2010, 3:25:50 pm'], + ['ddd, hA', 'Àìk, 3PM'], + ['M Mo MM MMMM MMM', '2 ọjọ́ 2 02 Èrèlè Èrl'], + ['YYYY YY', '2010 10'], + ['D Do DD', '14 ọjọ́ 14 14'], + ['d do dddd ddd dd', '0 ọjọ́ 0 Àìkú Àìk Àì'], + ['DDD DDDo DDDD', '45 ọjọ́ 45 045'], + ['w wo ww', '6 ọjọ́ 6 06'], + ['h hh', '3 03'], + ['H HH', '15 15'], + ['m mm', '25 25'], + ['s ss', '50 50'], + ['a A', 'pm PM'], + ['[the] DDDo [day of the year]', 'the ọjọ́ 45 day of the year'], + ['LTS', '3:25:50 PM'], + ['L', '14/02/2010'], + ['LL', '14 Èrèlè 2010'], + ['LLL', '14 Èrèlè 2010 3:25 PM'], + ['LLLL', 'Àìkú, 14 Èrèlè 2010 3:25 PM'], + ['l', '14/2/2010'], + ['ll', '14 Èrl 2010'], + ['lll', '14 Èrl 2010 3:25 PM'], + ['llll', 'Àìk, 14 Èrl 2010 3:25 PM'] + ], + b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), + i; + for (i = 0; i < a.length; i++) { + assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); + } +}); + +test('format ordinal', function (assert) { + assert.equal(moment([2011, 0, 1]).format('DDDo'), 'ọjọ́ 1', 'ọjọ́ 1'); + assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ọjọ́ 2', 'ọjọ́ 2'); + assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ọjọ́ 3', 'ọjọ́ 3'); + assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ọjọ́ 4', 'ọjọ́ 4'); + assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ọjọ́ 5', 'ọjọ́ 5'); + assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ọjọ́ 6', 'ọjọ́ 6'); + assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ọjọ́ 7', 'ọjọ́ 7'); + assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ọjọ́ 8', 'ọjọ́ 8'); + assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ọjọ́ 9', 'ọjọ́ 9'); + assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ọjọ́ 10', 'ọjọ́ 10'); + + assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ọjọ́ 11', 'ọjọ́ 11'); + assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ọjọ́ 12', 'ọjọ́ 12'); + assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ọjọ́ 13', 'ọjọ́ 13'); + assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ọjọ́ 14', 'ọjọ́ 14'); + assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ọjọ́ 15', 'ọjọ́ 15'); + assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ọjọ́ 16', 'ọjọ́ 16'); + assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ọjọ́ 17', 'ọjọ́ 17'); + assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ọjọ́ 18', 'ọjọ́ 18'); + assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ọjọ́ 19', 'ọjọ́ 19'); + assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ọjọ́ 20', 'ọjọ́ 20'); + + assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ọjọ́ 21', 'ọjọ́ 21'); + assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ọjọ́ 22', 'ọjọ́ 22'); + assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ọjọ́ 23', 'ọjọ́ 23'); + assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ọjọ́ 24', 'ọjọ́ 24'); + assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ọjọ́ 25', 'ọjọ́ 25'); + assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ọjọ́ 26', 'ọjọ́ 26'); + assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ọjọ́ 27', 'ọjọ́ 27'); + assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ọjọ́ 28', 'ọjọ́ 28'); + assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ọjọ́ 29', 'ọjọ́ 29'); + assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ọjọ́ 30', 'ọjọ́ 30'); + + assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ọjọ́ 31', 'ọjọ́ 31'); +}); + +test('format month', function (assert) { + var expected = 'Sẹ́rẹ́ Sẹ́r_Èrèlè Èrl_Ẹrẹ̀nà Ẹrn_Ìgbé Ìgb_Èbibi Èbi_Òkùdu Òkù_Agẹmo Agẹ_Ògún Ògú_Owewe Owe_Ọ̀wàrà Ọ̀wà_Bélú Bél_Ọ̀pẹ̀̀ Ọ̀pẹ̀̀'.split('_'), + i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); + } +}); + +test('format week', function (assert) { + var expected = 'Àìkú Àìk Àì_Ajé Ajé Aj_Ìsẹ́gun Ìsẹ́ Ìs_Ọjọ́rú Ọjr Ọr_Ọjọ́bọ Ọjb Ọb_Ẹtì Ẹtì Ẹt_Àbámẹ́ta Àbá Àb'.split('_'), + i; + for (i = 0; i < expected.length; i++) { + assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); + } +}); + +test('from', function (assert) { + var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ìsẹjú aayá die', '44 seconds = ìsẹjú aayá die'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ìsẹjú kan', '45 seconds = ìsẹjú kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ìsẹjú kan', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'ìsẹjú 2', '90 seconds = ìsẹjú 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'ìsẹjú 44', 'ìsẹjú 44 = ìsẹjú 44'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wákati kan', 'ìsẹjú 45 = wákati kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wákati kan', 'ìsẹjú 89 = wákati kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'wákati 2', 'ìsẹjú 90 = wákati 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'wákati 5', 'wákati 5 = wákati 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'wákati 21', 'wákati 21 = wákati 21'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ọjọ́ kan', '22 wákati = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ọjọ́ kan', '35 wákati = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'ọjọ́ 2', 'wákati 36 = ọjọ́ 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ọjọ́ kan', '1 = ọjọ́ kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'ọjọ́ 5', 'ọjọ́ 5 = ọjọ́ 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'ọjọ́ 25', 'ọjọ́ 25 = ọjọ́ 25'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'osù kan', 'ọjọ́ 26 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'osù kan', 'ọjọ́ 30 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'osù kan', 'ọjọ́ 43 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'osù 2', 'ọjọ́ 46 = osù 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'osù 2', 'ọjọ́ 75 = osù 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'osù 3', 'ọjọ́ 76 = osù 3'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'osù kan', 'osù 1 = osù kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'osù 5', 'osù 5 = osù 5'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ọdún kan', 'ọjọ 345 = ọdún kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'ọdún 2', 'ọjọ 548 = ọdún 2'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ọdún kan', 'ọdún 1 = ọdún kan'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'ọdún 5', 'ọdún 5 = ọdún 5'); +}); + +test('suffix', function (assert) { + assert.equal(moment(30000).from(0), 'ní ìsẹjú aayá die', 'prefix'); + assert.equal(moment(0).from(30000), 'ìsẹjú aayá die kọjá', 'suffix'); +}); + +test('now from now', function (assert) { + assert.equal(moment().fromNow(), 'ìsẹjú aayá die kọjá', 'now from now should display as in the past'); +}); + +test('fromNow', function (assert) { + assert.equal(moment().add({s: 30}).fromNow(), 'ní ìsẹjú aayá die', 'ní ìsẹjú aayá die'); + assert.equal(moment().add({d: 5}).fromNow(), 'ní ọjọ́ 5', 'ní ọjọ́ 5'); +}); + +test('calendar day', function (assert) { + var a = moment().hours(12).minutes(0).seconds(0); + + assert.equal(moment(a).calendar(), 'Ònì ni 12:00 PM', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'Ònì ni 12:25 PM', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'Ònì ni 1:00 PM', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'Ọ̀la ni 12:00 PM', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ònì ni 11:00 AM', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'Àna ni 12:00 PM', 'yesterday at the same time'); +}); + +test('calendar next week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tón\'bọ] [ni] LT'), 'Today + ' + i + ' days end of day'); + } +}); + +test('calendar last week', function (assert) { + var i, m; + + for (i = 2; i < 7; i++) { + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + assert.equal(m.calendar(), m.format('dddd [Ọsẹ̀ tólọ́] [ni] LT'), 'Today - ' + i + ' days end of day'); + } +}); + +test('calendar all else', function (assert) { + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + + weeksAgo = moment().subtract({w: 2}); + weeksFromNow = moment().add({w: 2}); + + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); +}); + +test('weeks year starting sunday format', function (assert) { + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 ọjọ́ 52', 'Jan 1 2012 should be week 52'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 2 2012 should be week 1'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 ọjọ́ 1', 'Jan 8 2012 should be week 1'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 9 2012 should be week 2'); + assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 15 2012 should be week 2'); +}); diff --git a/src/test/moment/create.js b/src/test/moment/create.js index 549b3c9..ac744b3 100644 --- a/src/test/moment/create.js +++ b/src/test/moment/create.js @@ -1100,3 +1100,9 @@ assert.ok(moment('02:30 p more extra stuff', 'hh:mm a').isValid(), 'because other tokens were parsed, date is valid'); assert.ok(moment('1/1/2016 extra data', ['a', 'M/D/YYYY']).isValid(), 'took second format, does not pick up on meridiem parsed from first format (good copy)'); }); + +test('invalid dates return invalid for methods that access the _d prop', function (assert) { + var momentAsDate = moment(['2015', '12', '1']).toDate(); + assert.ok(momentAsDate instanceof Date, 'toDate returns a Date object'); + assert.ok(isNaN(momentAsDate.getTime()), 'toDate returns an invalid Date invalid'); +}); diff --git a/src/test/moment/zones.js b/src/test/moment/zones.js index 257a258..785a1db 100644 --- a/src/test/moment/zones.js +++ b/src/test/moment/zones.js @@ -461,10 +461,28 @@ test('parse zone without a timezone', function (assert) { test.expectedDeprecations(); - var m = moment.parseZone('2016-02-01T00:00:00'); + var m1 = moment.parseZone('2016-02-01T00:00:00'); + var m2 = moment.parseZone('2016-02-01T00:00:00Z'); + var m3 = moment.parseZone('2016-02-01T00:00:00+00:00'); //Someone might argue this is not necessary, you could even argue that is wrong being here. + var m4 = moment.parseZone('2016-02-01T00:00:00+0000'); //Someone might argue this is not necessary, you could even argue that is wrong being here. assert.equal( - m.format('M D YYYY HH:mm:ss ZZ'), + m1.format('M D YYYY HH:mm:ss ZZ'), '2 1 2016 00:00:00 +0000', 'Not providing a timezone should keep the time and change the zone to 0' ); -}); + assert.equal( + m2.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); + assert.equal( + m3.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); + assert.equal( + m4.format('M D YYYY HH:mm:ss ZZ'), + '2 1 2016 00:00:00 +0000', + 'Not providing a timezone should keep the time and change the zone to 0' + ); +}); diff --git a/tasks/nuget.js b/tasks/nuget.js index bc1bf44..b5604b6 100644 --- a/tasks/nuget.js +++ b/tasks/nuget.js @@ -22,6 +22,14 @@ dest: './' } }); + grunt.registerTask('nugetkey_pre', function () { + grunt.option('key', process.env.NUGET_KEY); + grunt.option('source', 'https://www.nuget.org/api/v2/package'); + }); + grunt.registerTask('nugetkey_post', function () { + grunt.option('key', null); + grunt.option('source', null); + }); grunt.config('nugetpush', { dist: { src: 'Moment.js.*.nupkg' @@ -32,6 +40,6 @@ }); grunt.registerTask('nuget-publish', [ - 'nugetpack', 'nugetpush', 'clean:nuget' + 'nugetpack', 'nugetkey_pre', 'nugetkey', 'nugetkey_post', 'nugetpush', 'clean:nuget' ]); }; diff --git a/typing-tests/moment-tests.ts b/typing-tests/moment-tests.ts index f22e1d2..5a41aba 100644 --- a/typing-tests/moment-tests.ts +++ b/typing-tests/moment-tests.ts @@ -22,6 +22,8 @@ var day11 = moment(Date.UTC.apply({}, array)); var day12 = moment.unix(1318781876); +moment(null); +moment(undefined); moment({ years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123 }); moment("20140101", "YYYYMMDD", true); moment("20140101", "YYYYMMDD", "en"); @@ -223,6 +225,8 @@ localLang.format('LLLL'); globalLang.format('LLLL'); +moment.duration(null); +moment.duration(undefined); moment.duration(100); moment.duration(2, 'seconds'); moment.duration({ @@ -254,6 +258,10 @@ moment.locale(); moment.locale('en'); moment.locale(['en', 'fr']); + +moment.defineLocale('en', null); +moment.updateLocale('en', null); +moment.locale('en', null); // Defining a custom language: moment.locale('en', { diff --git a/typing-tests/tsconfig.json b/typing-tests/tsconfig.json index d000780..a7bc648 100644 --- a/typing-tests/tsconfig.json +++ b/typing-tests/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "module": "commonjs", "noEmit": true, - "noImplicitAny": true + "noImplicitAny": true, + "strictNullChecks": true }, "files": [ "../moment.d.ts",