momentjs-rails 2.10.3 → 2.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +3 -3
  4. data/news.md +3 -0
  5. data/test/dummy/log/test.log +6 -86
  6. data/test/dummy/tmp/cache/assets/D1C/680/sprockets%2F16ed4d5afdb2919596e6f8790e2116c2 +0 -0
  7. data/test/dummy/tmp/cache/assets/D35/CA0/sprockets%2F493e64bce2d302801dc01cf7cd096a58 +0 -0
  8. data/test/dummy/tmp/cache/assets/D3F/5F0/sprockets%2F4a6c53eae7c6e41a69a191578bbb6417 +0 -0
  9. data/test/dummy/tmp/cache/assets/D58/BD0/sprockets%2F4de9ddc9b725c715a54c98697b2528fe +0 -0
  10. data/test/dummy/tmp/cache/assets/D75/510/sprockets%2Fe690787ac522f47a6be024bfcc1767ee +0 -0
  11. data/test/dummy/tmp/cache/assets/E10/250/sprockets%2Fe4badb9ddfda484eb9671bf88567be61 +0 -0
  12. data/test/integration/navigation_test.rb +1 -1
  13. data/vendor/assets/javascripts/moment.js +212 -128
  14. data/vendor/assets/javascripts/moment/af.js +4 -4
  15. data/vendor/assets/javascripts/moment/ar-ma.js +4 -4
  16. data/vendor/assets/javascripts/moment/ar-sa.js +3 -3
  17. data/vendor/assets/javascripts/moment/ar-tn.js +4 -4
  18. data/vendor/assets/javascripts/moment/ar.js +3 -3
  19. data/vendor/assets/javascripts/moment/az.js +4 -4
  20. data/vendor/assets/javascripts/moment/be.js +4 -4
  21. data/vendor/assets/javascripts/moment/bg.js +4 -4
  22. data/vendor/assets/javascripts/moment/bn.js +5 -5
  23. data/vendor/assets/javascripts/moment/bo.js +4 -4
  24. data/vendor/assets/javascripts/moment/br.js +3 -3
  25. data/vendor/assets/javascripts/moment/bs.js +4 -4
  26. data/vendor/assets/javascripts/moment/ca.js +3 -3
  27. data/vendor/assets/javascripts/moment/cs.js +4 -4
  28. data/vendor/assets/javascripts/moment/cv.js +4 -4
  29. data/vendor/assets/javascripts/moment/cy.js +4 -4
  30. data/vendor/assets/javascripts/moment/da.js +4 -4
  31. data/vendor/assets/javascripts/moment/de-at.js +3 -3
  32. data/vendor/assets/javascripts/moment/de.js +3 -3
  33. data/vendor/assets/javascripts/moment/el.js +3 -3
  34. data/vendor/assets/javascripts/moment/en-au.js +3 -3
  35. data/vendor/assets/javascripts/moment/en-ca.js +3 -3
  36. data/vendor/assets/javascripts/moment/en-gb.js +3 -3
  37. data/vendor/assets/javascripts/moment/eo.js +4 -4
  38. data/vendor/assets/javascripts/moment/es.js +4 -4
  39. data/vendor/assets/javascripts/moment/et.js +4 -4
  40. data/vendor/assets/javascripts/moment/eu.js +6 -6
  41. data/vendor/assets/javascripts/moment/fa.js +4 -4
  42. data/vendor/assets/javascripts/moment/fi.js +5 -5
  43. data/vendor/assets/javascripts/moment/fo.js +4 -4
  44. data/vendor/assets/javascripts/moment/fr-ca.js +6 -6
  45. data/vendor/assets/javascripts/moment/fr.js +4 -4
  46. data/vendor/assets/javascripts/moment/fy.js +4 -4
  47. data/vendor/assets/javascripts/moment/gl.js +4 -4
  48. data/vendor/assets/javascripts/moment/he.js +6 -6
  49. data/vendor/assets/javascripts/moment/hi.js +3 -3
  50. data/vendor/assets/javascripts/moment/hr.js +4 -4
  51. data/vendor/assets/javascripts/moment/hu.js +4 -4
  52. data/vendor/assets/javascripts/moment/hy-am.js +4 -4
  53. data/vendor/assets/javascripts/moment/id.js +4 -4
  54. data/vendor/assets/javascripts/moment/is.js +4 -4
  55. data/vendor/assets/javascripts/moment/it.js +4 -4
  56. data/vendor/assets/javascripts/moment/ja.js +4 -4
  57. data/vendor/assets/javascripts/moment/jv.js +4 -4
  58. data/vendor/assets/javascripts/moment/ka.js +3 -3
  59. data/vendor/assets/javascripts/moment/km.js +4 -4
  60. data/vendor/assets/javascripts/moment/ko.js +3 -3
  61. data/vendor/assets/javascripts/moment/lb.js +3 -3
  62. data/vendor/assets/javascripts/moment/lt.js +17 -7
  63. data/vendor/assets/javascripts/moment/lv.js +4 -4
  64. data/vendor/assets/javascripts/moment/me.js +4 -4
  65. data/vendor/assets/javascripts/moment/mk.js +4 -4
  66. data/vendor/assets/javascripts/moment/ml.js +3 -3
  67. data/vendor/assets/javascripts/moment/mr.js +3 -3
  68. data/vendor/assets/javascripts/moment/ms-my.js +4 -4
  69. data/vendor/assets/javascripts/moment/ms.js +81 -0
  70. data/vendor/assets/javascripts/moment/my.js +3 -3
  71. data/vendor/assets/javascripts/moment/nb.js +4 -4
  72. data/vendor/assets/javascripts/moment/ne.js +3 -3
  73. data/vendor/assets/javascripts/moment/nl.js +4 -4
  74. data/vendor/assets/javascripts/moment/nn.js +4 -4
  75. data/vendor/assets/javascripts/moment/pl.js +4 -4
  76. data/vendor/assets/javascripts/moment/pt-br.js +5 -5
  77. data/vendor/assets/javascripts/moment/pt.js +4 -4
  78. data/vendor/assets/javascripts/moment/ro.js +2 -2
  79. data/vendor/assets/javascripts/moment/ru.js +4 -4
  80. data/vendor/assets/javascripts/moment/si.js +3 -3
  81. data/vendor/assets/javascripts/moment/sk.js +4 -4
  82. data/vendor/assets/javascripts/moment/sl.js +4 -4
  83. data/vendor/assets/javascripts/moment/sq.js +4 -4
  84. data/vendor/assets/javascripts/moment/sr-cyrl.js +4 -4
  85. data/vendor/assets/javascripts/moment/sr.js +4 -4
  86. data/vendor/assets/javascripts/moment/sv.js +4 -4
  87. data/vendor/assets/javascripts/moment/ta.js +4 -4
  88. data/vendor/assets/javascripts/moment/th.js +4 -4
  89. data/vendor/assets/javascripts/moment/tl-ph.js +4 -4
  90. data/vendor/assets/javascripts/moment/tr.js +4 -4
  91. data/vendor/assets/javascripts/moment/tzl.js +84 -0
  92. data/vendor/assets/javascripts/moment/tzm-latn.js +4 -4
  93. data/vendor/assets/javascripts/moment/tzm.js +4 -4
  94. data/vendor/assets/javascripts/moment/uk.js +4 -4
  95. data/vendor/assets/javascripts/moment/uz.js +4 -4
  96. data/vendor/assets/javascripts/moment/vi.js +6 -6
  97. data/vendor/assets/javascripts/moment/zh-cn.js +5 -5
  98. data/vendor/assets/javascripts/moment/zh-tw.js +5 -5
  99. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ecbb975f247a7d1689999cff015d72d564469b8
4
- data.tar.gz: 8d9fb91691c855910a1533ea2c273d8c8134d6bd
3
+ metadata.gz: 829a52b9d5e8ef07eca1f128eb4682cea2baaa57
4
+ data.tar.gz: dd4293a97731b5191392ea7251f1b18d4dab5909
5
5
  SHA512:
6
- metadata.gz: e70cc141df19bc1f881ae932c55ee3849271e1e587c93e4c466052f2d7a748c1fea1ff9fa38837fa29198ba2b381920c4869176be0638d8a5d5b15f7cb193dc4
7
- data.tar.gz: 729c90235279487f207829ab849c42021b86224baa0bb2e45d652d43a4f20ccab0dd979de0f61456ebe349769f7ebcdf4a5589e7ce187489068e7e141c509e45
6
+ metadata.gz: a64517a443f5529263dc7c4b05e369459370bfecb941ac19cb75da801ffc4bb717d4bcca7d76898c23c30541e48223385918478bf5bcf82d785dabf03d2c52de
7
+ data.tar.gz: 3a27b5df03de322d9043771373d71b19fc961aae62ea131d173bc57decf47b176206c52421cb2eeb76d521d27378deebee36f0f4741d4cdc2a6dadb472049c0f
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2011 YOURNAME
1
+ Copyright 2011 Derek Prior
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -24,8 +24,8 @@ If you want to include a localization file, also add the following directive:
24
24
 
25
25
  ## Versioning
26
26
 
27
- momentjs-rails 2.10.3 == Moment.js 2.10.3
27
+ momentjs-rails 2.10.6 == Moment.js 2.10.6
28
28
 
29
- Every attempt is made to mirror the currently shipping Momentum.js version number wherever possible.
30
- The major, minor, and patch version numbers will always represent the Momentum.js version. Should a gem
29
+ Every attempt is made to mirror the currently shipping Moment.js version number wherever possible.
30
+ The major, minor, and patch version numbers will always represent the Moment.js version. Should a gem
31
31
  bug be discovered, a 4th version identifier will be added and incremented.
data/news.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### Version 2.10.6 (2015-10-06)
2
+ - Updated Moment.js to 2.10.6
3
+
1
4
  ### Version 2.10.3 (2015-06-09)
2
5
  - Updated Moment.js to 2.10.3
3
6
 
@@ -1,88 +1,8 @@
1
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:00:54 -0400
2
- Compiled moment.js (0ms) (pid 11385)
3
- Served asset /moment.js - 200 OK (6ms)
4
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-09-19 11:00:54 -0400
5
- Compiled moment/fr.js (0ms) (pid 11385)
6
- Served asset /moment/fr.js - 200 OK (23ms)
7
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:00:54 -0400
8
- Served asset /moment.js - 200 OK (0ms)
9
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:01:37 -0400
10
- Served asset /moment.js - 200 OK (11ms)
11
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-09-19 11:01:37 -0400
12
- Served asset /moment/fr.js - 200 OK (1ms)
13
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:01:37 -0400
14
- Served asset /moment.js - 200 OK (0ms)
15
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
16
- Served asset /moment.js - 200 OK (2ms)
17
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
18
- Served asset /moment/fr.js - 200 OK (1ms)
19
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
20
- Served asset /moment.js - 200 OK (0ms)
21
- Started GET "/assets/moment.js" for 127.0.0.1 at 2014-01-09 09:25:18 -0500
22
- Compiled moment.js (1ms) (pid 4859)
23
- Served asset /moment.js - 200 OK (10ms)
24
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2014-01-09 09:25:18 -0500
25
- Compiled moment/fr.js (0ms) (pid 4859)
26
- Served asset /moment/fr.js - 200 OK (4ms)
27
- Started GET "/assets/moment.js" for 127.0.0.1 at 2014-01-09 09:25:18 -0500
28
- Served asset /moment.js - 200 OK (0ms)
29
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:43:59 -0500
30
- Compiled moment.js (1ms) (pid 19537)
31
- Served asset /moment.js - 200 OK (7ms)
32
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-01-12 15:43:59 -0500
33
- Compiled moment/fr.js (0ms) (pid 19537)
34
- Served asset /moment/fr.js - 200 OK (4ms)
35
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:43:59 -0500
36
- Served asset /moment.js - 200 OK (0ms)
37
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:44:23 -0500
38
- Served asset /moment.js - 200 OK (3ms)
39
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-01-12 15:44:23 -0500
40
- Served asset /moment/fr.js - 200 OK (1ms)
41
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:44:23 -0500
42
- Served asset /moment.js - 200 OK (0ms)
43
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:44:26 -0500
44
- Served asset /moment.js - 200 OK (2ms)
45
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-01-12 15:44:26 -0500
46
- Served asset /moment/fr.js - 200 OK (1ms)
47
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:44:26 -0500
48
- Served asset /moment.js - 200 OK (0ms)
49
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:54:20 -0500
50
- Compiled moment.js (1ms) (pid 23404)
51
- Served asset /moment.js - 200 OK (12ms)
52
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-01-12 15:54:20 -0500
53
- Served asset /moment/fr.js - 200 OK (1ms)
54
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:54:20 -0500
55
- Served asset /moment.js - 200 OK (0ms)
56
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:56:44 -0500
57
- Served asset /moment.js - 200 OK (3ms)
58
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-01-12 15:56:44 -0500
59
- Served asset /moment/fr.js - 200 OK (1ms)
60
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-01-12 15:56:44 -0500
61
- Served asset /moment.js - 200 OK (0ms)
62
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:41:14 -0400
63
- Compiled moment.js (1ms) (pid 16165)
64
- Served asset /moment.js - 200 OK (11ms)
65
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-04-24 15:41:14 -0400
66
- Compiled moment/fr.js (0ms) (pid 16165)
1
+ Started GET "/assets/moment.js" for 127.0.0.1 at 2015-10-07 10:20:23 -0400
2
+ Compiled moment.js (1ms) (pid 93192)
3
+ Served asset /moment.js - 200 OK (8ms)
4
+ Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-10-07 10:20:23 -0400
5
+ Compiled moment/fr.js (0ms) (pid 93192)
67
6
  Served asset /moment/fr.js - 200 OK (4ms)
68
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:41:14 -0400
69
- Served asset /moment.js - 200 OK (0ms)
70
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:41:25 -0400
71
- Served asset /moment.js - 200 OK (2ms)
72
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-04-24 15:41:25 -0400
73
- Served asset /moment/fr.js - 200 OK (1ms)
74
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:41:25 -0400
75
- Served asset /moment.js - 200 OK (0ms)
76
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:44:20 -0400
77
- Served asset /moment.js - 200 OK (3ms)
78
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-04-24 15:44:20 -0400
79
- Served asset /moment/fr.js - 200 OK (1ms)
80
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:44:20 -0400
81
- Served asset /moment.js - 200 OK (0ms)
82
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-06-09 08:51:18 -0400
83
- Compiled moment.js (1ms) (pid 83147)
84
- Served asset /moment.js - 200 OK (13ms)
85
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-06-09 08:51:18 -0400
86
- Served asset /moment/fr.js - 200 OK (2ms)
87
- Started GET "/assets/moment.js" for 127.0.0.1 at 2015-06-09 08:51:18 -0400
7
+ Started GET "/assets/moment.js" for 127.0.0.1 at 2015-10-07 10:20:23 -0400
88
8
  Served asset /moment.js - 200 OK (0ms)
@@ -8,7 +8,7 @@ class NavigationTest < ActionDispatch::IntegrationTest
8
8
 
9
9
  test 'momentjs response is for the expected version' do
10
10
  get '/assets/moment.js'
11
- assert_match(/utils_hooks__hooks.version = '2\.10\.3'/, @response.body)
11
+ assert_match(/utils_hooks__hooks.version = '2\.10\.6'/, @response.body)
12
12
  end
13
13
 
14
14
  test 'can access momentjs translation' do
@@ -1,5 +1,5 @@
1
1
  //! moment.js
2
- //! version : 2.10.3
2
+ //! version : 2.10.6
3
3
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4
4
  //! license : MIT
5
5
  //! momentjs.com
@@ -94,6 +94,7 @@
94
94
  flags.overflow < 0 &&
95
95
  !flags.empty &&
96
96
  !flags.invalidMonth &&
97
+ !flags.invalidWeekday &&
97
98
  !flags.nullInput &&
98
99
  !flags.invalidFormat &&
99
100
  !flags.userInvalidated;
@@ -174,7 +175,7 @@
174
175
  // Moment prototype object
175
176
  function Moment(config) {
176
177
  copyConfig(this, config);
177
- this._d = new Date(+config._d);
178
+ this._d = new Date(config._d != null ? config._d.getTime() : NaN);
178
179
  // Prevent infinite loop in case updateOffset creates new moment
179
180
  // objects.
180
181
  if (updateInProgress === false) {
@@ -188,16 +189,20 @@
188
189
  return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
189
190
  }
190
191
 
192
+ function absFloor (number) {
193
+ if (number < 0) {
194
+ return Math.ceil(number);
195
+ } else {
196
+ return Math.floor(number);
197
+ }
198
+ }
199
+
191
200
  function toInt(argumentForCoercion) {
192
201
  var coercedNumber = +argumentForCoercion,
193
202
  value = 0;
194
203
 
195
204
  if (coercedNumber !== 0 && isFinite(coercedNumber)) {
196
- if (coercedNumber >= 0) {
197
- value = Math.floor(coercedNumber);
198
- } else {
199
- value = Math.ceil(coercedNumber);
200
- }
205
+ value = absFloor(coercedNumber);
201
206
  }
202
207
 
203
208
  return value;
@@ -295,9 +300,7 @@
295
300
  function defineLocale (name, values) {
296
301
  if (values !== null) {
297
302
  values.abbr = name;
298
- if (!locales[name]) {
299
- locales[name] = new Locale();
300
- }
303
+ locales[name] = locales[name] || new Locale();
301
304
  locales[name].set(values);
302
305
 
303
306
  // backwards compat for now: also set the locale
@@ -401,16 +404,14 @@
401
404
  }
402
405
 
403
406
  function zeroFill(number, targetLength, forceSign) {
404
- var output = '' + Math.abs(number),
407
+ var absNumber = '' + Math.abs(number),
408
+ zerosToFill = targetLength - absNumber.length,
405
409
  sign = number >= 0;
406
-
407
- while (output.length < targetLength) {
408
- output = '0' + output;
409
- }
410
- return (sign ? (forceSign ? '+' : '') : '-') + output;
410
+ return (sign ? (forceSign ? '+' : '') : '-') +
411
+ Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
411
412
  }
412
413
 
413
- var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g;
414
+ var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
414
415
 
415
416
  var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
416
417
 
@@ -478,10 +479,7 @@
478
479
  }
479
480
 
480
481
  format = expandFormat(format, m.localeData());
481
-
482
- if (!formatFunctions[format]) {
483
- formatFunctions[format] = makeFormatFunction(format);
484
- }
482
+ formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
485
483
 
486
484
  return formatFunctions[format](m);
487
485
  }
@@ -525,8 +523,15 @@
525
523
 
526
524
  var regexes = {};
527
525
 
526
+ function isFunction (sth) {
527
+ // https://github.com/moment/moment/issues/2325
528
+ return typeof sth === 'function' &&
529
+ Object.prototype.toString.call(sth) === '[object Function]';
530
+ }
531
+
532
+
528
533
  function addRegexToken (token, regex, strictRegex) {
529
- regexes[token] = typeof regex === 'function' ? regex : function (isStrict) {
534
+ regexes[token] = isFunction(regex) ? regex : function (isStrict) {
530
535
  return (isStrict && strictRegex) ? strictRegex : regex;
531
536
  };
532
537
  }
@@ -734,12 +739,11 @@
734
739
  }
735
740
 
736
741
  function deprecate(msg, fn) {
737
- var firstTime = true,
738
- msgWithStack = msg + '\n' + (new Error()).stack;
742
+ var firstTime = true;
739
743
 
740
744
  return extend(function () {
741
745
  if (firstTime) {
742
- warn(msgWithStack);
746
+ warn(msg + '\n' + (new Error()).stack);
743
747
  firstTime = false;
744
748
  }
745
749
  return fn.apply(this, arguments);
@@ -787,14 +791,14 @@
787
791
  getParsingFlags(config).iso = true;
788
792
  for (i = 0, l = isoDates.length; i < l; i++) {
789
793
  if (isoDates[i][1].exec(string)) {
790
- // match[5] should be 'T' or undefined
791
- config._f = isoDates[i][0] + (match[6] || ' ');
794
+ config._f = isoDates[i][0];
792
795
  break;
793
796
  }
794
797
  }
795
798
  for (i = 0, l = isoTimes.length; i < l; i++) {
796
799
  if (isoTimes[i][1].exec(string)) {
797
- config._f += isoTimes[i][0];
800
+ // match[6] should be 'T' or space
801
+ config._f += (match[6] || ' ') + isoTimes[i][0];
798
802
  break;
799
803
  }
800
804
  }
@@ -873,7 +877,10 @@
873
877
  addRegexToken('YYYYY', match1to6, match6);
874
878
  addRegexToken('YYYYYY', match1to6, match6);
875
879
 
876
- addParseToken(['YYYY', 'YYYYY', 'YYYYYY'], YEAR);
880
+ addParseToken(['YYYYY', 'YYYYYY'], YEAR);
881
+ addParseToken('YYYY', function (input, array) {
882
+ array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
883
+ });
877
884
  addParseToken('YY', function (input, array) {
878
885
  array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
879
886
  });
@@ -1000,18 +1007,18 @@
1000
1007
 
1001
1008
  //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1002
1009
  function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
1003
- var d = createUTCDate(year, 0, 1).getUTCDay();
1004
- var daysToAdd;
1005
- var dayOfYear;
1010
+ var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear;
1011
+ if (d < firstDayOfWeek) {
1012
+ d += 7;
1013
+ }
1014
+
1015
+ weekday = weekday != null ? 1 * weekday : firstDayOfWeek;
1006
1016
 
1007
- d = d === 0 ? 7 : d;
1008
- weekday = weekday != null ? weekday : firstDayOfWeek;
1009
- daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
1010
- dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
1017
+ dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday;
1011
1018
 
1012
1019
  return {
1013
- year : dayOfYear > 0 ? year : year - 1,
1014
- dayOfYear : dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
1020
+ year: dayOfYear > 0 ? year : year - 1,
1021
+ dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
1015
1022
  };
1016
1023
  }
1017
1024
 
@@ -1297,9 +1304,19 @@
1297
1304
  }
1298
1305
 
1299
1306
  function createFromConfig (config) {
1307
+ var res = new Moment(checkOverflow(prepareConfig(config)));
1308
+ if (res._nextDay) {
1309
+ // Adding is smart enough around DST
1310
+ res.add(1, 'd');
1311
+ res._nextDay = undefined;
1312
+ }
1313
+
1314
+ return res;
1315
+ }
1316
+
1317
+ function prepareConfig (config) {
1300
1318
  var input = config._i,
1301
- format = config._f,
1302
- res;
1319
+ format = config._f;
1303
1320
 
1304
1321
  config._locale = config._locale || locale_locales__getLocale(config._l);
1305
1322
 
@@ -1323,14 +1340,7 @@
1323
1340
  configFromInput(config);
1324
1341
  }
1325
1342
 
1326
- res = new Moment(checkOverflow(config));
1327
- if (res._nextDay) {
1328
- // Adding is smart enough around DST
1329
- res.add(1, 'd');
1330
- res._nextDay = undefined;
1331
- }
1332
-
1333
- return res;
1343
+ return config;
1334
1344
  }
1335
1345
 
1336
1346
  function configFromInput(config) {
@@ -1410,7 +1420,7 @@
1410
1420
  }
1411
1421
  res = moments[0];
1412
1422
  for (i = 1; i < moments.length; ++i) {
1413
- if (moments[i][fn](res)) {
1423
+ if (!moments[i].isValid() || moments[i][fn](res)) {
1414
1424
  res = moments[i];
1415
1425
  }
1416
1426
  }
@@ -1522,7 +1532,6 @@
1522
1532
  } else {
1523
1533
  return local__createLocal(input).local();
1524
1534
  }
1525
- return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();
1526
1535
  }
1527
1536
 
1528
1537
  function getDateOffset (m) {
@@ -1622,12 +1631,7 @@
1622
1631
  }
1623
1632
 
1624
1633
  function hasAlignedHourOffset (input) {
1625
- if (!input) {
1626
- input = 0;
1627
- }
1628
- else {
1629
- input = local__createLocal(input).utcOffset();
1630
- }
1634
+ input = input ? local__createLocal(input).utcOffset() : 0;
1631
1635
 
1632
1636
  return (this.utcOffset() - input) % 60 === 0;
1633
1637
  }
@@ -1640,12 +1644,24 @@
1640
1644
  }
1641
1645
 
1642
1646
  function isDaylightSavingTimeShifted () {
1643
- if (this._a) {
1644
- var other = this._isUTC ? create_utc__createUTC(this._a) : local__createLocal(this._a);
1645
- return this.isValid() && compareArrays(this._a, other.toArray()) > 0;
1647
+ if (typeof this._isDSTShifted !== 'undefined') {
1648
+ return this._isDSTShifted;
1646
1649
  }
1647
1650
 
1648
- return false;
1651
+ var c = {};
1652
+
1653
+ copyConfig(c, this);
1654
+ c = prepareConfig(c);
1655
+
1656
+ if (c._a) {
1657
+ var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
1658
+ this._isDSTShifted = this.isValid() &&
1659
+ compareArrays(c._a, other.toArray()) > 0;
1660
+ } else {
1661
+ this._isDSTShifted = false;
1662
+ }
1663
+
1664
+ return this._isDSTShifted;
1649
1665
  }
1650
1666
 
1651
1667
  function isLocal () {
@@ -1805,7 +1821,7 @@
1805
1821
  var add_subtract__add = createAdder(1, 'add');
1806
1822
  var add_subtract__subtract = createAdder(-1, 'subtract');
1807
1823
 
1808
- function moment_calendar__calendar (time) {
1824
+ function moment_calendar__calendar (time, formats) {
1809
1825
  // We want to compare the start of today, vs this.
1810
1826
  // Getting start-of-today depends on whether we're local/utc/offset or not.
1811
1827
  var now = time || local__createLocal(),
@@ -1817,7 +1833,7 @@
1817
1833
  diff < 1 ? 'sameDay' :
1818
1834
  diff < 2 ? 'nextDay' :
1819
1835
  diff < 7 ? 'nextWeek' : 'sameElse';
1820
- return this.format(this.localeData().calendar(format, this, local__createLocal(now)));
1836
+ return this.format(formats && formats[format] || this.localeData().calendar(format, this, local__createLocal(now)));
1821
1837
  }
1822
1838
 
1823
1839
  function clone () {
@@ -1864,14 +1880,6 @@
1864
1880
  }
1865
1881
  }
1866
1882
 
1867
- function absFloor (number) {
1868
- if (number < 0) {
1869
- return Math.ceil(number);
1870
- } else {
1871
- return Math.floor(number);
1872
- }
1873
- }
1874
-
1875
1883
  function diff (input, units, asFloat) {
1876
1884
  var that = cloneWithOffset(input, this),
1877
1885
  zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
@@ -2062,6 +2070,19 @@
2062
2070
  return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
2063
2071
  }
2064
2072
 
2073
+ function toObject () {
2074
+ var m = this;
2075
+ return {
2076
+ years: m.year(),
2077
+ months: m.month(),
2078
+ date: m.date(),
2079
+ hours: m.hours(),
2080
+ minutes: m.minutes(),
2081
+ seconds: m.seconds(),
2082
+ milliseconds: m.milliseconds()
2083
+ };
2084
+ }
2085
+
2065
2086
  function moment_valid__isValid () {
2066
2087
  return valid__isValid(this);
2067
2088
  }
@@ -2233,18 +2254,20 @@
2233
2254
  // HELPERS
2234
2255
 
2235
2256
  function parseWeekday(input, locale) {
2236
- if (typeof input === 'string') {
2237
- if (!isNaN(input)) {
2238
- input = parseInt(input, 10);
2239
- }
2240
- else {
2241
- input = locale.weekdaysParse(input);
2242
- if (typeof input !== 'number') {
2243
- return null;
2244
- }
2245
- }
2257
+ if (typeof input !== 'string') {
2258
+ return input;
2246
2259
  }
2247
- return input;
2260
+
2261
+ if (!isNaN(input)) {
2262
+ return parseInt(input, 10);
2263
+ }
2264
+
2265
+ input = locale.weekdaysParse(input);
2266
+ if (typeof input === 'number') {
2267
+ return input;
2268
+ }
2269
+
2270
+ return null;
2248
2271
  }
2249
2272
 
2250
2273
  // LOCALES
@@ -2267,9 +2290,7 @@
2267
2290
  function localeWeekdaysParse (weekdayName) {
2268
2291
  var i, mom, regex;
2269
2292
 
2270
- if (!this._weekdaysParse) {
2271
- this._weekdaysParse = [];
2272
- }
2293
+ this._weekdaysParse = this._weekdaysParse || [];
2273
2294
 
2274
2295
  for (i = 0; i < 7; i++) {
2275
2296
  // make the regex if we don't have it already
@@ -2416,12 +2437,26 @@
2416
2437
  return ~~(this.millisecond() / 10);
2417
2438
  });
2418
2439
 
2419
- function millisecond__milliseconds (token) {
2420
- addFormatToken(0, [token, 3], 0, 'millisecond');
2421
- }
2440
+ addFormatToken(0, ['SSS', 3], 0, 'millisecond');
2441
+ addFormatToken(0, ['SSSS', 4], 0, function () {
2442
+ return this.millisecond() * 10;
2443
+ });
2444
+ addFormatToken(0, ['SSSSS', 5], 0, function () {
2445
+ return this.millisecond() * 100;
2446
+ });
2447
+ addFormatToken(0, ['SSSSSS', 6], 0, function () {
2448
+ return this.millisecond() * 1000;
2449
+ });
2450
+ addFormatToken(0, ['SSSSSSS', 7], 0, function () {
2451
+ return this.millisecond() * 10000;
2452
+ });
2453
+ addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
2454
+ return this.millisecond() * 100000;
2455
+ });
2456
+ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
2457
+ return this.millisecond() * 1000000;
2458
+ });
2422
2459
 
2423
- millisecond__milliseconds('SSS');
2424
- millisecond__milliseconds('SSSS');
2425
2460
 
2426
2461
  // ALIASES
2427
2462
 
@@ -2432,11 +2467,19 @@
2432
2467
  addRegexToken('S', match1to3, match1);
2433
2468
  addRegexToken('SS', match1to3, match2);
2434
2469
  addRegexToken('SSS', match1to3, match3);
2435
- addRegexToken('SSSS', matchUnsigned);
2436
- addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
2470
+
2471
+ var token;
2472
+ for (token = 'SSSS'; token.length <= 9; token += 'S') {
2473
+ addRegexToken(token, matchUnsigned);
2474
+ }
2475
+
2476
+ function parseMs(input, array) {
2437
2477
  array[MILLISECOND] = toInt(('0.' + input) * 1000);
2438
- });
2478
+ }
2439
2479
 
2480
+ for (token = 'S'; token.length <= 9; token += 'S') {
2481
+ addParseToken(token, parseMs);
2482
+ }
2440
2483
  // MOMENTS
2441
2484
 
2442
2485
  var getSetMillisecond = makeGetSet('Milliseconds', false);
@@ -2483,6 +2526,7 @@
2483
2526
  momentPrototype__proto.startOf = startOf;
2484
2527
  momentPrototype__proto.subtract = add_subtract__subtract;
2485
2528
  momentPrototype__proto.toArray = toArray;
2529
+ momentPrototype__proto.toObject = toObject;
2486
2530
  momentPrototype__proto.toDate = toDate;
2487
2531
  momentPrototype__proto.toISOString = moment_format__toISOString;
2488
2532
  momentPrototype__proto.toJSON = moment_format__toISOString;
@@ -2582,19 +2626,23 @@
2582
2626
  LT : 'h:mm A',
2583
2627
  L : 'MM/DD/YYYY',
2584
2628
  LL : 'MMMM D, YYYY',
2585
- LLL : 'MMMM D, YYYY LT',
2586
- LLLL : 'dddd, MMMM D, YYYY LT'
2629
+ LLL : 'MMMM D, YYYY h:mm A',
2630
+ LLLL : 'dddd, MMMM D, YYYY h:mm A'
2587
2631
  };
2588
2632
 
2589
2633
  function longDateFormat (key) {
2590
- var output = this._longDateFormat[key];
2591
- if (!output && this._longDateFormat[key.toUpperCase()]) {
2592
- output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
2593
- return val.slice(1);
2594
- });
2595
- this._longDateFormat[key] = output;
2634
+ var format = this._longDateFormat[key],
2635
+ formatUpper = this._longDateFormat[key.toUpperCase()];
2636
+
2637
+ if (format || !formatUpper) {
2638
+ return format;
2596
2639
  }
2597
- return output;
2640
+
2641
+ this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
2642
+ return val.slice(1);
2643
+ });
2644
+
2645
+ return this._longDateFormat[key];
2598
2646
  }
2599
2647
 
2600
2648
  var defaultInvalidDate = 'Invalid date';
@@ -2803,12 +2851,29 @@
2803
2851
  return duration_add_subtract__addSubtract(this, input, value, -1);
2804
2852
  }
2805
2853
 
2854
+ function absCeil (number) {
2855
+ if (number < 0) {
2856
+ return Math.floor(number);
2857
+ } else {
2858
+ return Math.ceil(number);
2859
+ }
2860
+ }
2861
+
2806
2862
  function bubble () {
2807
2863
  var milliseconds = this._milliseconds;
2808
2864
  var days = this._days;
2809
2865
  var months = this._months;
2810
2866
  var data = this._data;
2811
- var seconds, minutes, hours, years = 0;
2867
+ var seconds, minutes, hours, years, monthsFromDays;
2868
+
2869
+ // if we have a mix of positive and negative values, bubble down first
2870
+ // check: https://github.com/moment/moment/issues/2166
2871
+ if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
2872
+ (milliseconds <= 0 && days <= 0 && months <= 0))) {
2873
+ milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
2874
+ days = 0;
2875
+ months = 0;
2876
+ }
2812
2877
 
2813
2878
  // The following code bubbles up values, see the tests for
2814
2879
  // examples of what that means.
@@ -2825,17 +2890,13 @@
2825
2890
 
2826
2891
  days += absFloor(hours / 24);
2827
2892
 
2828
- // Accurately convert days to years, assume start from year 0.
2829
- years = absFloor(daysToYears(days));
2830
- days -= absFloor(yearsToDays(years));
2831
-
2832
- // 30 days to a month
2833
- // TODO (iskren): Use anchor date (like 1st Jan) to compute this.
2834
- months += absFloor(days / 30);
2835
- days %= 30;
2893
+ // convert days to months
2894
+ monthsFromDays = absFloor(daysToMonths(days));
2895
+ months += monthsFromDays;
2896
+ days -= absCeil(monthsToDays(monthsFromDays));
2836
2897
 
2837
2898
  // 12 months -> 1 year
2838
- years += absFloor(months / 12);
2899
+ years = absFloor(months / 12);
2839
2900
  months %= 12;
2840
2901
 
2841
2902
  data.days = days;
@@ -2845,15 +2906,15 @@
2845
2906
  return this;
2846
2907
  }
2847
2908
 
2848
- function daysToYears (days) {
2909
+ function daysToMonths (days) {
2849
2910
  // 400 years have 146097 days (taking into account leap year rules)
2850
- return days * 400 / 146097;
2911
+ // 400 years have 12 months === 4800
2912
+ return days * 4800 / 146097;
2851
2913
  }
2852
2914
 
2853
- function yearsToDays (years) {
2854
- // years * 365 + absFloor(years / 4) -
2855
- // absFloor(years / 100) + absFloor(years / 400);
2856
- return years * 146097 / 400;
2915
+ function monthsToDays (months) {
2916
+ // the reverse of daysToMonths
2917
+ return months * 146097 / 4800;
2857
2918
  }
2858
2919
 
2859
2920
  function as (units) {
@@ -2865,11 +2926,11 @@
2865
2926
 
2866
2927
  if (units === 'month' || units === 'year') {
2867
2928
  days = this._days + milliseconds / 864e5;
2868
- months = this._months + daysToYears(days) * 12;
2929
+ months = this._months + daysToMonths(days);
2869
2930
  return units === 'month' ? months : months / 12;
2870
2931
  } else {
2871
2932
  // handle milliseconds separately because of floating point math errors (issue #1867)
2872
- days = this._days + Math.round(yearsToDays(this._months / 12));
2933
+ days = this._days + Math.round(monthsToDays(this._months));
2873
2934
  switch (units) {
2874
2935
  case 'week' : return days / 7 + milliseconds / 6048e5;
2875
2936
  case 'day' : return days + milliseconds / 864e5;
@@ -2919,7 +2980,7 @@
2919
2980
  };
2920
2981
  }
2921
2982
 
2922
- var duration_get__milliseconds = makeGetter('milliseconds');
2983
+ var milliseconds = makeGetter('milliseconds');
2923
2984
  var seconds = makeGetter('seconds');
2924
2985
  var minutes = makeGetter('minutes');
2925
2986
  var hours = makeGetter('hours');
@@ -2997,13 +3058,36 @@
2997
3058
  var iso_string__abs = Math.abs;
2998
3059
 
2999
3060
  function iso_string__toISOString() {
3061
+ // for ISO strings we do not use the normal bubbling rules:
3062
+ // * milliseconds bubble up until they become hours
3063
+ // * days do not bubble at all
3064
+ // * months bubble up until they become years
3065
+ // This is because there is no context-free conversion between hours and days
3066
+ // (think of clock changes)
3067
+ // and also not between days and months (28-31 days per month)
3068
+ var seconds = iso_string__abs(this._milliseconds) / 1000;
3069
+ var days = iso_string__abs(this._days);
3070
+ var months = iso_string__abs(this._months);
3071
+ var minutes, hours, years;
3072
+
3073
+ // 3600 seconds -> 60 minutes -> 1 hour
3074
+ minutes = absFloor(seconds / 60);
3075
+ hours = absFloor(minutes / 60);
3076
+ seconds %= 60;
3077
+ minutes %= 60;
3078
+
3079
+ // 12 months -> 1 year
3080
+ years = absFloor(months / 12);
3081
+ months %= 12;
3082
+
3083
+
3000
3084
  // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
3001
- var Y = iso_string__abs(this.years());
3002
- var M = iso_string__abs(this.months());
3003
- var D = iso_string__abs(this.days());
3004
- var h = iso_string__abs(this.hours());
3005
- var m = iso_string__abs(this.minutes());
3006
- var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000);
3085
+ var Y = years;
3086
+ var M = months;
3087
+ var D = days;
3088
+ var h = hours;
3089
+ var m = minutes;
3090
+ var s = seconds;
3007
3091
  var total = this.asSeconds();
3008
3092
 
3009
3093
  if (!total) {
@@ -3040,7 +3124,7 @@
3040
3124
  duration_prototype__proto.valueOf = duration_as__valueOf;
3041
3125
  duration_prototype__proto._bubble = bubble;
3042
3126
  duration_prototype__proto.get = duration_get__get;
3043
- duration_prototype__proto.milliseconds = duration_get__milliseconds;
3127
+ duration_prototype__proto.milliseconds = milliseconds;
3044
3128
  duration_prototype__proto.seconds = seconds;
3045
3129
  duration_prototype__proto.minutes = minutes;
3046
3130
  duration_prototype__proto.hours = hours;
@@ -3078,7 +3162,7 @@
3078
3162
  // Side effect imports
3079
3163
 
3080
3164
 
3081
- utils_hooks__hooks.version = '2.10.3';
3165
+ utils_hooks__hooks.version = '2.10.6';
3082
3166
 
3083
3167
  setHookCallback(local__createLocal);
3084
3168