public
Created

Changes in moment 2.3.0

  • Download Gist
changelog.md
Markdown

What is new to moment 2.3.0 (relative to 2.2.1)

ATTENTION (may break code) isValid reworked

#1140, #913

Completely new model for computing whether a moment is valid or not. Also added parsing flags to allow checking specific issues during parsing.

.format() now returns Ivalid Date for invalid moments. Read #1140 for more details.

Also added strick mode parsing, which is intolerant to all deviations from the format. #913

ATTENTION (may break code) toString always prints in English

#1139

toString should only be used for development/debugging purposes. If you want a long format in a particular language use .format('LLLL') instead.

ATTENTION (may break code) stricter iso parsing

#1092

Iso format will be used only if string doesn't have extra characters after format.

new languages

  • Australian English (en-au)
  • Bosnian (bs)
  • Uzbek (uz)
  • Lithuanian (lt)
  • Vietnamese (vn)

parse weekdays, week numbers and week years

#1141

Creating moments from string and format now supports weekday, week, week-year, and the iso variant. The week tokens interpretation only kicks in if neither month nor date-of-month are present in the tokens to prevent conflicting information coming from different tokens.

Parsing tokens:

  • e weekday
  • d, dd, ddd, dddd locale weekday, for example 'Monday'
  • E iso weekday
  • w week
  • W iso week
  • gg, gggg, ggggg week year
  • GG, GGGG, GGGGG iso week year

Smart language picker

#1142 fixes #1108 and #1109.

The .lang function accepts an array of languages and tries less specific variants too. Intended to be used with browser provided language preferences.

Added iso duration parsing

#1113

Duration objects can be created using an iso duration string like P2MT3H.

Added parseZone

#1106 fixes #887.

Change moment's timezone based on the input string

minor improvements

  • Language modules now return the language code #1146, #1147
  • Support for creating invalid moments. #1098 fixes #716
  • When using AMD tell moment not to export it as a global variable #1098
  • More precise array-of-formats parsing #1094

bugfixes

  • long strings won't confuse array-of-formats creation. #1143 fixed by #1164
  • formatting strings can contain newlines. #1151 fixed by #1158
  • fixed weird bug Prototype.js monkey patching Array. #1159, [2ccdbc0]
  • bg now uses 24H format #1157 fixes #1148
  • renamed language bundles from moment+langs to moment_with_langs to avoid issue with IIS, #1138 fixes #1118
  • updated hungarian translation #1137
  • IE < 9 work again after addition of extend() function #1115 fixes #1114
  • weekday now works on utc moments properly #1110
  • fixed isValid for unix format token #1086 fixes #1075
  • AM/PM for russian and ukranian #1072
  • fixes in russian, ukranian week names #1082
  • decapitalize dutch today/tomorrow/yesterday #1093 fixes #919
  • added proper am/pm for chineese #1056
  • fixed bug in node repl #1091 fixes #1084

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.