momentjs-rails 2.1.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/news.md +3 -0
  4. data/test/dummy/log/test.log +14 -139
  5. data/test/dummy/tmp/cache/assets/D1C/680/sprockets%2F16ed4d5afdb2919596e6f8790e2116c2 +0 -0
  6. data/test/dummy/tmp/cache/assets/D35/CA0/sprockets%2F493e64bce2d302801dc01cf7cd096a58 +0 -0
  7. data/test/dummy/tmp/cache/assets/D3F/5F0/sprockets%2F4a6c53eae7c6e41a69a191578bbb6417 +0 -0
  8. data/test/dummy/tmp/cache/assets/D58/BD0/sprockets%2F4de9ddc9b725c715a54c98697b2528fe +0 -0
  9. data/test/dummy/tmp/cache/assets/D75/510/sprockets%2Fe690787ac522f47a6be024bfcc1767ee +0 -0
  10. data/test/dummy/tmp/cache/assets/E10/250/sprockets%2Fe4badb9ddfda484eb9671bf88567be61 +0 -0
  11. data/test/integration/navigation_test.rb +1 -1
  12. data/vendor/assets/javascripts/moment.js +155 -42
  13. data/vendor/assets/javascripts/moment/ar-ma.js +52 -1
  14. data/vendor/assets/javascripts/moment/ar.js +52 -1
  15. data/vendor/assets/javascripts/moment/bg.js +83 -1
  16. data/vendor/assets/javascripts/moment/br.js +104 -1
  17. data/vendor/assets/javascripts/moment/ca.js +63 -1
  18. data/vendor/assets/javascripts/moment/cs.js +152 -1
  19. data/vendor/assets/javascripts/moment/cv.js +56 -1
  20. data/vendor/assets/javascripts/moment/da.js +53 -1
  21. data/vendor/assets/javascripts/moment/de.js +67 -1
  22. data/vendor/assets/javascripts/moment/el.js +76 -1
  23. data/vendor/assets/javascripts/moment/en-ca.js +56 -1
  24. data/vendor/assets/javascripts/moment/en-gb.js +60 -1
  25. data/vendor/assets/javascripts/moment/eo.js +60 -1
  26. data/vendor/assets/javascripts/moment/es.js +63 -1
  27. data/vendor/assets/javascripts/moment/et.js +57 -1
  28. data/vendor/assets/javascripts/moment/eu.js +57 -1
  29. data/vendor/assets/javascripts/moment/fa.js +94 -1
  30. data/vendor/assets/javascripts/moment/fi.js +100 -1
  31. data/vendor/assets/javascripts/moment/fr-ca.js +51 -1
  32. data/vendor/assets/javascripts/moment/fr.js +55 -1
  33. data/vendor/assets/javascripts/moment/gl.js +68 -1
  34. data/vendor/assets/javascripts/moment/he.js +73 -1
  35. data/vendor/assets/javascripts/moment/hi.js +102 -1
  36. data/vendor/assets/javascripts/moment/hr.js +140 -0
  37. data/vendor/assets/javascripts/moment/hu.js +94 -1
  38. data/vendor/assets/javascripts/moment/id.js +63 -1
  39. data/vendor/assets/javascripts/moment/is.js +121 -1
  40. data/vendor/assets/javascripts/moment/it.js +55 -1
  41. data/vendor/assets/javascripts/moment/ja.js +55 -1
  42. data/vendor/assets/javascripts/moment/ka.js +105 -1
  43. data/vendor/assets/javascripts/moment/ko.js +53 -1
  44. data/vendor/assets/javascripts/moment/lv.js +74 -1
  45. data/vendor/assets/javascripts/moment/ml.js +64 -0
  46. data/vendor/assets/javascripts/moment/mr.js +104 -0
  47. data/vendor/assets/javascripts/moment/ms-my.js +63 -1
  48. data/vendor/assets/javascripts/moment/nb.js +55 -2
  49. data/vendor/assets/javascripts/moment/ne.js +102 -1
  50. data/vendor/assets/javascripts/moment/nl.js +64 -1
  51. data/vendor/assets/javascripts/moment/nn.js +53 -1
  52. data/vendor/assets/javascripts/moment/pl.js +95 -1
  53. data/vendor/assets/javascripts/moment/pt-br.js +53 -1
  54. data/vendor/assets/javascripts/moment/pt.js +57 -1
  55. data/vendor/assets/javascripts/moment/ro.js +52 -1
  56. data/vendor/assets/javascripts/moment/ru.js +144 -1
  57. data/vendor/assets/javascripts/moment/sk.js +152 -1
  58. data/vendor/assets/javascripts/moment/sl.js +141 -1
  59. data/vendor/assets/javascripts/moment/sq.js +53 -1
  60. data/vendor/assets/javascripts/moment/sv.js +60 -1
  61. data/vendor/assets/javascripts/moment/th.js +55 -1
  62. data/vendor/assets/javascripts/moment/tr.js +89 -1
  63. data/vendor/assets/javascripts/moment/tzm-la.js +52 -1
  64. data/vendor/assets/javascripts/moment/tzm.js +52 -1
  65. data/vendor/assets/javascripts/moment/uk.js +138 -1
  66. data/vendor/assets/javascripts/moment/zh-cn.js +80 -1
  67. data/vendor/assets/javascripts/moment/zh-tw.js +80 -1
  68. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 788e8f0c378d64f7f40aae1e04f5de7fab3c1685
4
- data.tar.gz: 572ec979e2915e8329a84690369118eb7760fe15
3
+ metadata.gz: e72db56d51cf7e5fe91b467a0b6bfd71734b004e
4
+ data.tar.gz: e9160df8b82151849bb7f782d9cbbf1ad57d645d
5
5
  SHA512:
6
- metadata.gz: 09363f5b9f8fd522e9dd507bfc1f88a2f3da3d2ccf1ff9e0edf4561f8d5eded8578c1f96f5286666acc91d8db709bc15a63dfcd2884002ee7747234dce752de0
7
- data.tar.gz: 7b05e42bf3cb91d45c06e299038ec473c6293aed453fa5ad370391a40f17fe0d3ab4c9e4117693e45f8bba5e5246a414f7c57dccd138d2ad1f0c73945c5794fe
6
+ metadata.gz: e578afd22ba49caff9d23d185be3945645f209c57c591c328966bfa0a2c24a76810ce90fa4412080ba4f7b93b37e416cf4d832c62ca0baa0b30f0758fa21fcec
7
+ data.tar.gz: 2a12778ba0838e3ee1293f49995fbaa0daeefd79514038725d26e7f6fc1e4f7b7b3a163e0f7559d9b1f49de8915a699dd754620ceed39bbd1e993b3e2d6974e6
data/README.md CHANGED
@@ -24,7 +24,7 @@ If you want to include a localization file, also add the following directive:
24
24
 
25
25
  ## Versioning
26
26
 
27
- momentjs-rails 2.0.0.1 == Moment.js 2.0.0
27
+ momentjs-rails 2.2.1 == Moment.js 2.2.1
28
28
 
29
29
  Every attempt is made to mirror the currently shipping Momentum.js version number wherever possible.
30
30
  The major, minor, and patch version numbers will always represent the Momentum.js version. Should a gem
data/news.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### Version 2.2.1 (2013-09-19)
2
+ - Updated to Moment.js to 2.2.1
3
+
1
4
  ### Version 2.1.0 (2013-07-20)
2
5
  - Updated to Moment.js to 2.1.0
3
6
  - Updated localization files using compressed versions (ready for browser)
@@ -1,145 +1,20 @@
1
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:04:06 -0400
2
- Compiled moment.js (0ms) (pid 43125)
3
- Served asset /moment.js - 200 OK (14ms)
4
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:04:06 -0400
5
- Compiled moment/fr.js (0ms) (pid 43125)
6
- Served asset /moment/fr.js - 200 OK (96ms)
7
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:05:04 -0400
8
- Served asset /moment.js - 200 OK (25ms)
9
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:05:04 -0400
10
- Served asset /moment/fr.js - 200 OK (2ms)
11
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:05:17 -0400
12
- Served asset /moment.js - 200 OK (2ms)
13
- Started GET "/assets/momentmotherfucker/fr.js" for 127.0.0.1 at 2013-03-16 16:05:17 -0400
14
- Served asset /momentmotherfucker/fr.js - 404 Not Found (1ms)
15
- Started GET "/assets/moments.js" for 127.0.0.1 at 2013-03-16 16:05:53 -0400
16
- Served asset /moments.js - 404 Not Found (1ms)
17
- Started GET "/assets/moment/rfr.js" for 127.0.0.1 at 2013-03-16 16:05:53 -0400
18
- Served asset /moment/rfr.js - 404 Not Found (1ms)
19
- Started GET "/assets/moments.js" for 127.0.0.1 at 2013-03-16 16:06:02 -0400
20
- Served asset /moments.js - 404 Not Found (1ms)
21
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:06:02 -0400
22
- Served asset /moment/fr.js - 200 OK (2ms)
23
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:06:22 -0400
24
- Served asset /moment.js - 200 OK (2ms)
25
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:06:22 -0400
26
- Served asset /moment/fr.js - 200 OK (1ms)
27
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:07:08 -0400
28
- Served asset /moment.js - 200 OK (3ms)
29
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:07:08 -0400
30
- Served asset /moment/fr.js - 200 OK (1ms)
31
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:08:10 -0400
32
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:08:10 -0400
33
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:08:17 -0400
34
- Served asset /moment.js - 200 OK (2ms)
35
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:08:17 -0400
36
- Served asset /moment/fr.js - 200 OK (1ms)
37
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:08:51 -0400
38
- Served asset /moment.js - 200 OK (2ms)
39
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:08:51 -0400
40
- Served asset /moment/fr.js - 200 OK (1ms)
41
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:08:57 -0400
42
- Served asset /moment.js - 200 OK (2ms)
43
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:08:57 -0400
44
- Served asset /moment/fr.js - 200 OK (1ms)
45
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:09:13 -0400
46
- Served asset /moment.js - 200 OK (2ms)
47
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:09:13 -0400
48
- Served asset /moment/fr.js - 200 OK (2ms)
49
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:09:49 -0400
50
- Served asset /moment.js - 200 OK (2ms)
51
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:09:49 -0400
52
- Served asset /moment/fr.js - 200 OK (1ms)
53
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:10:05 -0400
54
- Served asset /moment.js - 200 OK (2ms)
55
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:10:05 -0400
56
- Served asset /moment/fr.js - 200 OK (1ms)
57
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:11:18 -0400
58
- Served asset /moment.js - 200 OK (2ms)
59
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:11:18 -0400
60
- Served asset /moment/fr.js - 200 OK (1ms)
61
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:12:28 -0400
62
- Served asset /moment.js - 200 OK (16ms)
63
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:12:28 -0400
64
- Served asset /moment/fr.js - 200 OK (10ms)
65
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:12:47 -0400
66
- Served asset /moment.js - 200 OK (1ms)
67
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:12:47 -0400
68
- Served asset /moment/fr.js - 200 OK (11ms)
69
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:14:04 -0400
70
- Served asset /moment.js - 200 OK (1ms)
71
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:14:04 -0400
72
- Served asset /moment/fr.js - 200 OK (1ms)
73
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:15:39 -0400
74
- Served asset /moment.js - 200 OK (1ms)
75
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:15:39 -0400
76
- Served asset /moment/fr.js - 200 OK (12ms)
77
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:37:24 -0400
78
- Served asset /moment.js - 200 OK (14ms)
79
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:37:24 -0400
80
- Served asset /moment/fr.js - 200 OK (11ms)
81
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:37:32 -0400
82
- Served asset /moment.js - 200 OK (1ms)
83
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:37:32 -0400
84
- Served asset /moment/fr.js - 200 OK (12ms)
85
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:44:51 -0400
86
- Served asset /moment.js - 200 OK (46ms)
87
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:44:52 -0400
88
- Served asset /moment/fr.js - 200 OK (12ms)
89
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:44:52 -0400
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
90
8
  Served asset /moment.js - 200 OK (0ms)
91
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:45:09 -0400
92
- Served asset /moment.js - 200 OK (1ms)
93
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:45:09 -0400
94
- Served asset /moment/fr.js - 200 OK (11ms)
95
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:45:09 -0400
96
- Served asset /moment.js - 200 OK (0ms)
97
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:47:53 -0400
98
- Compiled moment.js (0ms) (pid 62815)
99
- Served asset /moment.js - 200 OK (18ms)
100
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:47:53 -0400
101
- Compiled moment/fr.js (0ms) (pid 62815)
102
- Served asset /moment/fr.js - 200 OK (18ms)
103
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:47:53 -0400
104
- Served asset /moment.js - 200 OK (0ms)
105
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:48:16 -0400
106
- Served asset /moment.js - 200 OK (2ms)
107
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:48:16 -0400
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
108
12
  Served asset /moment/fr.js - 200 OK (1ms)
109
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:48:16 -0400
110
- Served asset /moment.js - 200 OK (0ms)
111
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:50:40 -0400
112
- Compiled moment.js (10ms) (pid 64044)
113
- Served asset /moment.js - 200 OK (40ms)
114
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:50:40 -0400
115
- Served asset /moment/fr.js - 200 OK (2ms)
116
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:50:40 -0400
117
- Served asset /moment.js - 200 OK (0ms)
118
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:50:53 -0400
119
- Compiled moment.js (11ms) (pid 64218)
120
- Served asset /moment.js - 200 OK (16ms)
121
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-03-16 16:50:53 -0400
122
- Served asset /moment/fr.js - 200 OK (1ms)
123
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-03-16 16:50:53 -0400
124
- Served asset /moment.js - 200 OK (0ms)
125
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-06-06 21:49:55 -0400
126
- Served asset /moment.js - 200 OK (2ms)
127
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-06-06 21:49:55 -0400
128
- Compiled moment/fr.js (0ms) (pid 73048)
129
- Served asset /moment/fr.js - 200 OK (28ms)
130
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-06-06 21:49:55 -0400
131
- Served asset /moment.js - 200 OK (0ms)
132
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-07-20 10:00:25 -0400
133
- Compiled moment.js (0ms) (pid 5373)
134
- Served asset /moment.js - 200 OK (75ms)
135
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-07-20 10:00:25 -0400
136
- Compiled moment/fr.js (0ms) (pid 5373)
137
- Served asset /moment/fr.js - 200 OK (96ms)
138
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-07-20 10:00:25 -0400
13
+ Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:01:37 -0400
139
14
  Served asset /moment.js - 200 OK (0ms)
140
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-07-20 10:01:19 -0400
15
+ Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
141
16
  Served asset /moment.js - 200 OK (2ms)
142
- Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-07-20 10:01:19 -0400
17
+ Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
143
18
  Served asset /moment/fr.js - 200 OK (1ms)
144
- Started GET "/assets/moment.js" for 127.0.0.1 at 2013-07-20 10:01:19 -0400
19
+ Started GET "/assets/moment.js" for 127.0.0.1 at 2013-09-19 11:02:11 -0400
145
20
  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(/VERSION = "2\.1\.0"/, @response.body)
11
+ assert_match(/VERSION = "2\.2\.1"/, @response.body)
12
12
  end
13
13
 
14
14
  test 'can access momentjs translation' do
@@ -1,8 +1,8 @@
1
- // moment.js
2
- // version : 2.1.0
3
- // author : Tim Wood
4
- // license : MIT
5
- // momentjs.com
1
+ //! moment.js
2
+ //! version : 2.2.1
3
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4
+ //! license : MIT
5
+ //! momentjs.com
6
6
 
7
7
  (function (undefined) {
8
8
 
@@ -11,7 +11,7 @@
11
11
  ************************************/
12
12
 
13
13
  var moment,
14
- VERSION = "2.1.0",
14
+ VERSION = "2.2.1",
15
15
  round = Math.round, i,
16
16
  // internal storage for language config files
17
17
  languages = {},
@@ -21,7 +21,7 @@
21
21
 
22
22
  // ASP.NET json date format regex
23
23
  aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
24
- aspNetTimeSpanJsonRegex = /(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,
24
+ aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,
25
25
 
26
26
  // format tokens
27
27
  formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,
@@ -73,6 +73,7 @@
73
73
  h : 'hour',
74
74
  d : 'day',
75
75
  w : 'week',
76
+ W : 'isoweek',
76
77
  M : 'month',
77
78
  y : 'year'
78
79
  },
@@ -257,18 +258,18 @@
257
258
  this._input = duration;
258
259
 
259
260
  // representation for dateAddRemove
260
- this._milliseconds = milliseconds +
261
+ this._milliseconds = +milliseconds +
261
262
  seconds * 1e3 + // 1000
262
263
  minutes * 6e4 + // 1000 * 60
263
264
  hours * 36e5; // 1000 * 60 * 60
264
265
  // Because of dateAddRemove treats 24 hours as different from a
265
266
  // day when working around DST, we need to store them separately
266
- this._days = days +
267
+ this._days = +days +
267
268
  weeks * 7;
268
269
  // It is impossible translate months into days without knowing
269
270
  // which months you are are talking about, so we have to store
270
271
  // it separately.
271
- this._months = months +
272
+ this._months = +months +
272
273
  years * 12;
273
274
 
274
275
  this._data = {};
@@ -315,8 +316,7 @@
315
316
  days = duration._days,
316
317
  months = duration._months,
317
318
  minutes,
318
- hours,
319
- currentDate;
319
+ hours;
320
320
 
321
321
  if (milliseconds) {
322
322
  mom._d.setTime(+mom._d + milliseconds * isAdding);
@@ -371,7 +371,8 @@
371
371
  ************************************/
372
372
 
373
373
 
374
- Language.prototype = {
374
+ extend(Language.prototype, {
375
+
375
376
  set : function (config) {
376
377
  var prop, i;
377
378
  for (i in config) {
@@ -404,7 +405,7 @@
404
405
  for (i = 0; i < 12; i++) {
405
406
  // make the regex if we don't have it already
406
407
  if (!this._monthsParse[i]) {
407
- mom = moment([2000, i]);
408
+ mom = moment.utc([2000, i]);
408
409
  regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
409
410
  this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
410
411
  }
@@ -470,7 +471,9 @@
470
471
  },
471
472
 
472
473
  isPM : function (input) {
473
- return ((input + '').toLowerCase()[0] === 'p');
474
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
475
+ // Using charAt should be more compatible.
476
+ return ((input + '').toLowerCase().charAt(0) === 'p');
474
477
  },
475
478
 
476
479
  _meridiemParse : /[ap]\.?m?\.?/i,
@@ -541,7 +544,7 @@
541
544
  dow : 0, // Sunday is the first day of the week.
542
545
  doy : 6 // The week that contains Jan 1st is the first week of the year.
543
546
  }
544
- };
547
+ });
545
548
 
546
549
  // Loads a language definition into the `languages` cache. The function
547
550
  // takes a key and optionally values. If not in the browser and no values
@@ -556,6 +559,11 @@
556
559
  return languages[key];
557
560
  }
558
561
 
562
+ // Remove a language from the `languages` cache. Mostly useful in tests.
563
+ function unloadLang(key) {
564
+ delete languages[key];
565
+ }
566
+
559
567
  // Determines which language definition to use and returns it.
560
568
  //
561
569
  // With no parameters, it will return the global language. If you
@@ -574,7 +582,7 @@
574
582
  return moment.fn._lang;
575
583
  }
576
584
  }
577
- return languages[key];
585
+ return languages[key] || moment.fn._lang;
578
586
  }
579
587
 
580
588
 
@@ -612,21 +620,29 @@
612
620
 
613
621
  // format date using native date object
614
622
  function formatMoment(m, format) {
623
+
624
+ format = expandFormat(format, m.lang());
625
+
626
+ if (!formatFunctions[format]) {
627
+ formatFunctions[format] = makeFormatFunction(format);
628
+ }
629
+
630
+ return formatFunctions[format](m);
631
+ }
632
+
633
+ function expandFormat(format, lang) {
615
634
  var i = 5;
616
635
 
617
636
  function replaceLongDateFormatTokens(input) {
618
- return m.lang().longDateFormat(input) || input;
637
+ return lang.longDateFormat(input) || input;
619
638
  }
620
639
 
621
- while (i-- && localFormattingTokens.test(format)) {
640
+ while (i-- && (localFormattingTokens.lastIndex = 0,
641
+ localFormattingTokens.test(format))) {
622
642
  format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
623
643
  }
624
644
 
625
- if (!formatFunctions[format]) {
626
- formatFunctions[format] = makeFormatFunction(format);
627
- }
628
-
629
- return formatFunctions[format](m);
645
+ return format;
630
646
  }
631
647
 
632
648
 
@@ -701,7 +717,9 @@
701
717
  // MONTH
702
718
  case 'M' : // fall through to MM
703
719
  case 'MM' :
704
- datePartArray[1] = (input == null) ? 0 : ~~input - 1;
720
+ if (input != null) {
721
+ datePartArray[1] = ~~input - 1;
722
+ }
705
723
  break;
706
724
  case 'MMM' : // fall through to MMMM
707
725
  case 'MMMM' :
@@ -714,11 +732,17 @@
714
732
  }
715
733
  break;
716
734
  // DAY OF MONTH
717
- case 'D' : // fall through to DDDD
718
- case 'DD' : // fall through to DDDD
735
+ case 'D' : // fall through to DD
736
+ case 'DD' :
737
+ if (input != null) {
738
+ datePartArray[2] = ~~input;
739
+ }
740
+ break;
741
+ // DAY OF YEAR
719
742
  case 'DDD' : // fall through to DDDD
720
743
  case 'DDDD' :
721
744
  if (input != null) {
745
+ datePartArray[1] = 0;
722
746
  datePartArray[2] = ~~input;
723
747
  }
724
748
  break;
@@ -781,13 +805,24 @@
781
805
  // note: all values past the year are optional and will default to the lowest possible value.
782
806
  // [year, month, day , hour, minute, second, millisecond]
783
807
  function dateFromArray(config) {
784
- var i, date, input = [];
808
+ var i, date, input = [], currentDate;
785
809
 
786
810
  if (config._d) {
787
811
  return;
788
812
  }
789
813
 
790
- for (i = 0; i < 7; i++) {
814
+ // Default to current date.
815
+ // * if no year, month, day of month are given, default to today
816
+ // * if day of month is given, default month and year
817
+ // * if month is given, default only year
818
+ // * if year is given, don't default anything
819
+ currentDate = currentDateArray(config);
820
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
821
+ config._a[i] = input[i] = currentDate[i];
822
+ }
823
+
824
+ // Zero out whatever was not defaulted, including time
825
+ for (; i < 7; i++) {
791
826
  config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
792
827
  }
793
828
 
@@ -808,12 +843,47 @@
808
843
  config._d = date;
809
844
  }
810
845
 
846
+ function dateFromObject(config) {
847
+ var o = config._i;
848
+
849
+ if (config._d) {
850
+ return;
851
+ }
852
+
853
+ config._a = [
854
+ o.years || o.year || o.y,
855
+ o.months || o.month || o.M,
856
+ o.days || o.day || o.d,
857
+ o.hours || o.hour || o.h,
858
+ o.minutes || o.minute || o.m,
859
+ o.seconds || o.second || o.s,
860
+ o.milliseconds || o.millisecond || o.ms
861
+ ];
862
+
863
+ dateFromArray(config);
864
+ }
865
+
866
+ function currentDateArray(config) {
867
+ var now = new Date();
868
+ if (config._useUTC) {
869
+ return [
870
+ now.getUTCFullYear(),
871
+ now.getUTCMonth(),
872
+ now.getUTCDate()
873
+ ];
874
+ } else {
875
+ return [now.getFullYear(), now.getMonth(), now.getDate()];
876
+ }
877
+ }
878
+
811
879
  // date from string and format string
812
880
  function makeDateFromStringAndFormat(config) {
813
881
  // This array is used to make a Date, either with `new Date` or `Date.UTC`
814
- var tokens = config._f.match(formattingTokens),
815
- string = config._i,
816
- i, parsedInput;
882
+ var lang = getLangDefinition(config._l),
883
+ string = '' + config._i,
884
+ i, parsedInput, tokens;
885
+
886
+ tokens = expandFormat(config._f, lang).match(formattingTokens);
817
887
 
818
888
  config._a = [];
819
889
 
@@ -915,8 +985,12 @@
915
985
  } else if (isArray(input)) {
916
986
  config._a = input.slice(0);
917
987
  dateFromArray(config);
988
+ } else if (input instanceof Date) {
989
+ config._d = new Date(+input);
990
+ } else if (typeof(input) === 'object') {
991
+ dateFromObject(config);
918
992
  } else {
919
- config._d = input instanceof Date ? new Date(+input) : new Date(input);
993
+ config._d = new Date(input);
920
994
  }
921
995
  }
922
996
 
@@ -1037,7 +1111,7 @@
1037
1111
  _l : lang,
1038
1112
  _i : input,
1039
1113
  _f : format
1040
- });
1114
+ }).utc();
1041
1115
  };
1042
1116
 
1043
1117
  // creating with unix timestamp (in seconds)
@@ -1098,8 +1172,13 @@
1098
1172
  if (!key) {
1099
1173
  return moment.fn._lang._abbr;
1100
1174
  }
1175
+ key = key.toLowerCase();
1176
+ key = key.replace('_', '-');
1101
1177
  if (values) {
1102
1178
  loadLang(key, values);
1179
+ } else if (values === null) {
1180
+ unloadLang(key);
1181
+ key = 'en';
1103
1182
  } else if (!languages[key]) {
1104
1183
  getLangDefinition(key);
1105
1184
  }
@@ -1130,7 +1209,7 @@
1130
1209
  ************************************/
1131
1210
 
1132
1211
 
1133
- moment.fn = Moment.prototype = {
1212
+ extend(moment.fn = Moment.prototype, {
1134
1213
 
1135
1214
  clone : function () {
1136
1215
  return moment(this);
@@ -1180,6 +1259,14 @@
1180
1259
  return !!this._isValid;
1181
1260
  },
1182
1261
 
1262
+ invalidAt: function () {
1263
+ var i, arr1 = this._a, arr2 = (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray();
1264
+ for (i = 6; i >= 0 && arr1[i] === arr2[i]; --i) {
1265
+ // empty loop body
1266
+ }
1267
+ return i;
1268
+ },
1269
+
1183
1270
  utc : function () {
1184
1271
  return this.zone(0);
1185
1272
  },
@@ -1262,7 +1349,7 @@
1262
1349
  },
1263
1350
 
1264
1351
  calendar : function () {
1265
- var diff = this.diff(moment().startOf('day'), 'days', true),
1352
+ var diff = this.diff(moment().zone(this.zone()).startOf('day'), 'days', true),
1266
1353
  format = diff < -6 ? 'sameElse' :
1267
1354
  diff < -1 ? 'lastWeek' :
1268
1355
  diff < 0 ? 'lastDay' :
@@ -1299,8 +1386,7 @@
1299
1386
 
1300
1387
  month : function (input) {
1301
1388
  var utc = this._isUTC ? 'UTC' : '',
1302
- dayOfMonth,
1303
- daysInMonth;
1389
+ dayOfMonth;
1304
1390
 
1305
1391
  if (input != null) {
1306
1392
  if (typeof input === 'string') {
@@ -1334,6 +1420,7 @@
1334
1420
  this.date(1);
1335
1421
  /* falls through */
1336
1422
  case 'week':
1423
+ case 'isoweek':
1337
1424
  case 'day':
1338
1425
  this.hours(0);
1339
1426
  /* falls through */
@@ -1351,13 +1438,16 @@
1351
1438
  // weeks are a special case
1352
1439
  if (units === 'week') {
1353
1440
  this.weekday(0);
1441
+ } else if (units === 'isoweek') {
1442
+ this.isoWeekday(1);
1354
1443
  }
1355
1444
 
1356
1445
  return this;
1357
1446
  },
1358
1447
 
1359
1448
  endOf: function (units) {
1360
- return this.startOf(units).add(units, 1).subtract('ms', 1);
1449
+ units = normalizeUnits(units);
1450
+ return this.startOf(units).add((units === 'isoweek' ? 'week' : units), 1).subtract('ms', 1);
1361
1451
  },
1362
1452
 
1363
1453
  isAfter: function (input, units) {
@@ -1413,6 +1503,17 @@
1413
1503
  return this._isUTC ? "Coordinated Universal Time" : "";
1414
1504
  },
1415
1505
 
1506
+ hasAlignedHourOffset : function (input) {
1507
+ if (!input) {
1508
+ input = 0;
1509
+ }
1510
+ else {
1511
+ input = moment(input).zone();
1512
+ }
1513
+
1514
+ return (this.zone() - input) % 60 === 0;
1515
+ },
1516
+
1416
1517
  daysInMonth : function () {
1417
1518
  return moment.utc([this.year(), this.month() + 1, 0]).date();
1418
1519
  },
@@ -1454,6 +1555,16 @@
1454
1555
  return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
1455
1556
  },
1456
1557
 
1558
+ get : function (units) {
1559
+ units = normalizeUnits(units);
1560
+ return this[units.toLowerCase()]();
1561
+ },
1562
+
1563
+ set : function (units, value) {
1564
+ units = normalizeUnits(units);
1565
+ this[units.toLowerCase()](value);
1566
+ },
1567
+
1457
1568
  // If passed a language key, it will set the language for this
1458
1569
  // instance. Otherwise, it will return the language configuration
1459
1570
  // variables for this instance.
@@ -1465,7 +1576,7 @@
1465
1576
  return this;
1466
1577
  }
1467
1578
  }
1468
- };
1579
+ });
1469
1580
 
1470
1581
  // helper for adding shortcuts
1471
1582
  function makeGetterAndSetter(name, key) {
@@ -1503,7 +1614,8 @@
1503
1614
  ************************************/
1504
1615
 
1505
1616
 
1506
- moment.duration.fn = Duration.prototype = {
1617
+ extend(moment.duration.fn = Duration.prototype, {
1618
+
1507
1619
  _bubble : function () {
1508
1620
  var milliseconds = this._milliseconds,
1509
1621
  days = this._days,
@@ -1592,7 +1704,7 @@
1592
1704
  },
1593
1705
 
1594
1706
  lang : moment.fn.lang
1595
- };
1707
+ });
1596
1708
 
1597
1709
  function makeDurationGetter(name) {
1598
1710
  moment.duration.fn[name] = function () {
@@ -1636,6 +1748,7 @@
1636
1748
  }
1637
1749
  });
1638
1750
 
1751
+ /* EMBED_LANGUAGES */
1639
1752
 
1640
1753
  /************************************
1641
1754
  Exposing Moment