secret
Last active

moment 2.2.0 changelog

  • Download Gist
changelog.md
Markdown

What is new in moment 2.2.0 (relative to 2.1.0)

New Languages

  • Croatian (hr) - 1013
  • Malayalam (ml) - 1003
  • Marathi (mr) - 995

bundle moment with languages

issue: 1057 commit: b24a5f1

In addition to moment source code a bundled version with all languages will be available for download on momentjs.com. The files will be available in min/moment+langs.js and min/moment+langs.min.js.

Custom bundles can be generated with

grunt embed_languages uglify --embed_languages=en-gb,fr-ca,de

which would generate min/moment+customlangs.js and min/moment+customlangs.min.js.

bower support

Good news for all bower users. moment is now registered in the bower registry!

moment constructor now accepts an object

Moment objects can now be created with an object:

moment({years: 2010, months: 3, days: 5, hours: 15, minutes: 10, seconds: 3, milliseconds: 123})
moment({year: 2010, month: 3, day: 5, hour: 15, minute: 10, second: 3, millisecond: 123})
moment({y: 2010, M: 3, d: 5, h: 15, m: 10, s: 3, ms: 123})

moment({hour: 15, minute: 10})

localization tokens LT, L, LL, LLL, LLLL now work when parsing

Now the following code would work:

moment.lang("it");
moment("01/03/2013", "L"); // L maps to DD/MM/YYYY
moment.lang("en");
moment("03/01/2013", "L"); // L maps to MM/DD/YYYY

Added moment.fn.invalidAt

After detecting an invalid a moment with moment.fn.isValid(), the actual invalid component can be extracted with invalidAt

Added moment.fn.get('unit') and moment.fn.set('unit', value)

moment().get('date'); // moment().date()
moment().set('date', 5); // moment().date(5)

creating moments will default to current date

This is pretty helpful when creating a moment and omitting year, month, day in the format.

moment("15", "HH") // today at 15 o'clock
moment("5 15", "DD HH") // this month, 5 day 15 o'clock
moment("Feb 6 15", "MMM DD HH") // this year, 6th February, 15 o'clock

all test files are now jshinted

No more style issues in all tests ... yeey!

added moment.fn.hasAlignedHourOffset

Returns whether the current timezone offset is a multiple of 60 minutes (1 hour). Mainly to use in tests, so they don't break in weird timezones.

language files converted to UMD

All files in lang/*.js are now implemented with the UMD pattern, meaning they just-work (tm) in amd, cjs (node) and browser environments.

bugfixes

  • lowercase months and days in Danish translation 1051
  • added Russian month cases 942
  • fixed isPM for IE7 and IE8 Quirks mode 1033
  • norwegian translation fixes 1022
  • moment.fn.calendar now respects timezone information 1019
  • fixed hebrew dual form 998
  • moment.utc now works when cloning moments 1007
  • some test improvements, so they don't break in weird timezones
  • fixed short month/weekday names in Ukranian 1002
  • language identifiers are case and dash insensitive 985
  • fixed norwegian nynorsk L/l date format 966
  • durations can now be created with scring values for component keys 979
  • fixed a weird parsing issue related to RegExp#test remembering last matc position 971
  • ASP.net duration format now correctly handles days 910
  • integers are converted to strings in moment string + format constructor 930
  • startOf/same/endOf now suppoer isoWeek 918
  • setting non-existend language doesn't crash in browsers 6673d2c08
  • moment.lang(key, null) uninstalls a language definition (useful in tests)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.