momentjs-rails 2.10.2 → 2.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/news.md +3 -7
- data/test/dummy/log/test.log +7 -0
- data/test/dummy/tmp/cache/assets/D3F/5F0/sprockets%2F4a6c53eae7c6e41a69a191578bbb6417 +0 -0
- data/test/dummy/tmp/cache/assets/D58/BD0/sprockets%2F4de9ddc9b725c715a54c98697b2528fe +0 -0
- data/test/dummy/tmp/cache/assets/D75/510/sprockets%2Fe690787ac522f47a6be024bfcc1767ee +0 -0
- data/test/integration/navigation_test.rb +1 -2
- data/vendor/assets/javascripts/moment.js +95 -67
- data/vendor/assets/javascripts/moment/ar.js +2 -2
- data/vendor/assets/javascripts/moment/cv.js +22 -22
- data/vendor/assets/javascripts/moment/es.js +5 -5
- data/vendor/assets/javascripts/moment/hr.js +2 -2
- data/vendor/assets/javascripts/moment/jv.js +82 -0
- data/vendor/assets/javascripts/moment/lv.js +33 -16
- data/vendor/assets/javascripts/moment/me.js +108 -0
- data/vendor/assets/javascripts/moment/my.js +3 -2
- data/vendor/assets/javascripts/moment/pl.js +6 -1
- data/vendor/assets/javascripts/moment/pt-br.js +5 -5
- data/vendor/assets/javascripts/moment/pt.js +5 -5
- data/vendor/assets/javascripts/moment/si.js +64 -0
- data/vendor/assets/javascripts/moment/sl.js +49 -36
- data/vendor/assets/javascripts/moment/sv.js +2 -2
- data/vendor/assets/javascripts/moment/zh-cn.js +11 -11
- data/vendor/assets/javascripts/moment/zh-tw.js +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ecbb975f247a7d1689999cff015d72d564469b8
|
4
|
+
data.tar.gz: 8d9fb91691c855910a1533ea2c273d8c8134d6bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e70cc141df19bc1f881ae932c55ee3849271e1e587c93e4c466052f2d7a748c1fea1ff9fa38837fa29198ba2b381920c4869176be0638d8a5d5b15f7cb193dc4
|
7
|
+
data.tar.gz: 729c90235279487f207829ab849c42021b86224baa0bb2e45d652d43a4f20ccab0dd979de0f61456ebe349769f7ebcdf4a5589e7ce187489068e7e141c509e45
|
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.10.
|
27
|
+
momentjs-rails 2.10.3 == Moment.js 2.10.3
|
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
data/test/dummy/log/test.log
CHANGED
@@ -79,3 +79,10 @@ Started GET "/assets/moment/fr.js" for 127.0.0.1 at 2015-04-24 15:44:20 -0400
|
|
79
79
|
Served asset /moment/fr.js - 200 OK (1ms)
|
80
80
|
Started GET "/assets/moment.js" for 127.0.0.1 at 2015-04-24 15:44:20 -0400
|
81
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
|
88
|
+
Served asset /moment.js - 200 OK (0ms)
|
Binary file
|
Binary file
|
Binary file
|
@@ -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\.
|
11
|
+
assert_match(/utils_hooks__hooks.version = '2\.10\.3'/, @response.body)
|
12
12
|
end
|
13
13
|
|
14
14
|
test 'can access momentjs translation' do
|
@@ -16,4 +16,3 @@ class NavigationTest < ActionDispatch::IntegrationTest
|
|
16
16
|
assert_response :success
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
@@ -1,5 +1,5 @@
|
|
1
1
|
//! moment.js
|
2
|
-
//! version : 2.10.
|
2
|
+
//! version : 2.10.3
|
3
3
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
4
4
|
//! license : MIT
|
5
5
|
//! momentjs.com
|
@@ -22,28 +22,12 @@
|
|
22
22
|
hookCallback = callback;
|
23
23
|
}
|
24
24
|
|
25
|
-
function defaultParsingFlags() {
|
26
|
-
// We need to deep clone this object.
|
27
|
-
return {
|
28
|
-
empty : false,
|
29
|
-
unusedTokens : [],
|
30
|
-
unusedInput : [],
|
31
|
-
overflow : -2,
|
32
|
-
charsLeftOver : 0,
|
33
|
-
nullInput : false,
|
34
|
-
invalidMonth : null,
|
35
|
-
invalidFormat : false,
|
36
|
-
userInvalidated : false,
|
37
|
-
iso : false
|
38
|
-
};
|
39
|
-
}
|
40
|
-
|
41
25
|
function isArray(input) {
|
42
26
|
return Object.prototype.toString.call(input) === '[object Array]';
|
43
27
|
}
|
44
28
|
|
45
29
|
function isDate(input) {
|
46
|
-
return Object.prototype.toString.call(input) === '[object Date]'
|
30
|
+
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
|
47
31
|
}
|
48
32
|
|
49
33
|
function map(arr, fn) {
|
@@ -80,21 +64,45 @@
|
|
80
64
|
return createLocalOrUTC(input, format, locale, strict, true).utc();
|
81
65
|
}
|
82
66
|
|
67
|
+
function defaultParsingFlags() {
|
68
|
+
// We need to deep clone this object.
|
69
|
+
return {
|
70
|
+
empty : false,
|
71
|
+
unusedTokens : [],
|
72
|
+
unusedInput : [],
|
73
|
+
overflow : -2,
|
74
|
+
charsLeftOver : 0,
|
75
|
+
nullInput : false,
|
76
|
+
invalidMonth : null,
|
77
|
+
invalidFormat : false,
|
78
|
+
userInvalidated : false,
|
79
|
+
iso : false
|
80
|
+
};
|
81
|
+
}
|
82
|
+
|
83
|
+
function getParsingFlags(m) {
|
84
|
+
if (m._pf == null) {
|
85
|
+
m._pf = defaultParsingFlags();
|
86
|
+
}
|
87
|
+
return m._pf;
|
88
|
+
}
|
89
|
+
|
83
90
|
function valid__isValid(m) {
|
84
91
|
if (m._isValid == null) {
|
92
|
+
var flags = getParsingFlags(m);
|
85
93
|
m._isValid = !isNaN(m._d.getTime()) &&
|
86
|
-
|
87
|
-
!
|
88
|
-
!
|
89
|
-
!
|
90
|
-
!
|
91
|
-
!
|
94
|
+
flags.overflow < 0 &&
|
95
|
+
!flags.empty &&
|
96
|
+
!flags.invalidMonth &&
|
97
|
+
!flags.nullInput &&
|
98
|
+
!flags.invalidFormat &&
|
99
|
+
!flags.userInvalidated;
|
92
100
|
|
93
101
|
if (m._strict) {
|
94
102
|
m._isValid = m._isValid &&
|
95
|
-
|
96
|
-
|
97
|
-
|
103
|
+
flags.charsLeftOver === 0 &&
|
104
|
+
flags.unusedTokens.length === 0 &&
|
105
|
+
flags.bigHour === undefined;
|
98
106
|
}
|
99
107
|
}
|
100
108
|
return m._isValid;
|
@@ -103,10 +111,10 @@
|
|
103
111
|
function valid__createInvalid (flags) {
|
104
112
|
var m = create_utc__createUTC(NaN);
|
105
113
|
if (flags != null) {
|
106
|
-
extend(m
|
114
|
+
extend(getParsingFlags(m), flags);
|
107
115
|
}
|
108
116
|
else {
|
109
|
-
m.
|
117
|
+
getParsingFlags(m).userInvalidated = true;
|
110
118
|
}
|
111
119
|
|
112
120
|
return m;
|
@@ -142,7 +150,7 @@
|
|
142
150
|
to._offset = from._offset;
|
143
151
|
}
|
144
152
|
if (typeof from._pf !== 'undefined') {
|
145
|
-
to._pf = from
|
153
|
+
to._pf = getParsingFlags(from);
|
146
154
|
}
|
147
155
|
if (typeof from._locale !== 'undefined') {
|
148
156
|
to._locale = from._locale;
|
@@ -177,7 +185,7 @@
|
|
177
185
|
}
|
178
186
|
|
179
187
|
function isMoment (obj) {
|
180
|
-
return obj instanceof Moment || (obj != null &&
|
188
|
+
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
|
181
189
|
}
|
182
190
|
|
183
191
|
function toInt(argumentForCoercion) {
|
@@ -615,7 +623,7 @@
|
|
615
623
|
if (month != null) {
|
616
624
|
array[MONTH] = month;
|
617
625
|
} else {
|
618
|
-
config.
|
626
|
+
getParsingFlags(config).invalidMonth = input;
|
619
627
|
}
|
620
628
|
});
|
621
629
|
|
@@ -699,7 +707,7 @@
|
|
699
707
|
var overflow;
|
700
708
|
var a = m._a;
|
701
709
|
|
702
|
-
if (a && m.
|
710
|
+
if (a && getParsingFlags(m).overflow === -2) {
|
703
711
|
overflow =
|
704
712
|
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
|
705
713
|
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
|
@@ -709,11 +717,11 @@
|
|
709
717
|
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
|
710
718
|
-1;
|
711
719
|
|
712
|
-
if (m.
|
720
|
+
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
713
721
|
overflow = DATE;
|
714
722
|
}
|
715
723
|
|
716
|
-
m.
|
724
|
+
getParsingFlags(m).overflow = overflow;
|
717
725
|
}
|
718
726
|
|
719
727
|
return m;
|
@@ -726,10 +734,12 @@
|
|
726
734
|
}
|
727
735
|
|
728
736
|
function deprecate(msg, fn) {
|
729
|
-
var firstTime = true
|
737
|
+
var firstTime = true,
|
738
|
+
msgWithStack = msg + '\n' + (new Error()).stack;
|
739
|
+
|
730
740
|
return extend(function () {
|
731
741
|
if (firstTime) {
|
732
|
-
warn(
|
742
|
+
warn(msgWithStack);
|
733
743
|
firstTime = false;
|
734
744
|
}
|
735
745
|
return fn.apply(this, arguments);
|
@@ -774,7 +784,7 @@
|
|
774
784
|
match = from_string__isoRegex.exec(string);
|
775
785
|
|
776
786
|
if (match) {
|
777
|
-
config.
|
787
|
+
getParsingFlags(config).iso = true;
|
778
788
|
for (i = 0, l = isoDates.length; i < l; i++) {
|
779
789
|
if (isoDates[i][1].exec(string)) {
|
780
790
|
// match[5] should be 'T' or undefined
|
@@ -1054,7 +1064,7 @@
|
|
1054
1064
|
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
|
1055
1065
|
|
1056
1066
|
if (config._dayOfYear > daysInYear(yearToUse)) {
|
1057
|
-
config.
|
1067
|
+
getParsingFlags(config)._overflowDayOfYear = true;
|
1058
1068
|
}
|
1059
1069
|
|
1060
1070
|
date = createUTCDate(yearToUse, 0, config._dayOfYear);
|
@@ -1150,7 +1160,7 @@
|
|
1150
1160
|
}
|
1151
1161
|
|
1152
1162
|
config._a = [];
|
1153
|
-
config.
|
1163
|
+
getParsingFlags(config).empty = true;
|
1154
1164
|
|
1155
1165
|
// This array is used to make a Date, either with `new Date` or `Date.UTC`
|
1156
1166
|
var string = '' + config._i,
|
@@ -1166,7 +1176,7 @@
|
|
1166
1176
|
if (parsedInput) {
|
1167
1177
|
skipped = string.substr(0, string.indexOf(parsedInput));
|
1168
1178
|
if (skipped.length > 0) {
|
1169
|
-
config.
|
1179
|
+
getParsingFlags(config).unusedInput.push(skipped);
|
1170
1180
|
}
|
1171
1181
|
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
1172
1182
|
totalParsedInputLength += parsedInput.length;
|
@@ -1174,27 +1184,29 @@
|
|
1174
1184
|
// don't parse if it's not a known token
|
1175
1185
|
if (formatTokenFunctions[token]) {
|
1176
1186
|
if (parsedInput) {
|
1177
|
-
config.
|
1187
|
+
getParsingFlags(config).empty = false;
|
1178
1188
|
}
|
1179
1189
|
else {
|
1180
|
-
config.
|
1190
|
+
getParsingFlags(config).unusedTokens.push(token);
|
1181
1191
|
}
|
1182
1192
|
addTimeToArrayFromToken(token, parsedInput, config);
|
1183
1193
|
}
|
1184
1194
|
else if (config._strict && !parsedInput) {
|
1185
|
-
config.
|
1195
|
+
getParsingFlags(config).unusedTokens.push(token);
|
1186
1196
|
}
|
1187
1197
|
}
|
1188
1198
|
|
1189
1199
|
// add remaining unparsed input length to the string
|
1190
|
-
config.
|
1200
|
+
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
|
1191
1201
|
if (string.length > 0) {
|
1192
|
-
config.
|
1202
|
+
getParsingFlags(config).unusedInput.push(string);
|
1193
1203
|
}
|
1194
1204
|
|
1195
1205
|
// clear _12h flag if hour is <= 12
|
1196
|
-
if (config.
|
1197
|
-
|
1206
|
+
if (getParsingFlags(config).bigHour === true &&
|
1207
|
+
config._a[HOUR] <= 12 &&
|
1208
|
+
config._a[HOUR] > 0) {
|
1209
|
+
getParsingFlags(config).bigHour = undefined;
|
1198
1210
|
}
|
1199
1211
|
// handle meridiem
|
1200
1212
|
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
|
@@ -1238,7 +1250,7 @@
|
|
1238
1250
|
currentScore;
|
1239
1251
|
|
1240
1252
|
if (config._f.length === 0) {
|
1241
|
-
config.
|
1253
|
+
getParsingFlags(config).invalidFormat = true;
|
1242
1254
|
config._d = new Date(NaN);
|
1243
1255
|
return;
|
1244
1256
|
}
|
@@ -1249,7 +1261,6 @@
|
|
1249
1261
|
if (config._useUTC != null) {
|
1250
1262
|
tempConfig._useUTC = config._useUTC;
|
1251
1263
|
}
|
1252
|
-
tempConfig._pf = defaultParsingFlags();
|
1253
1264
|
tempConfig._f = config._f[i];
|
1254
1265
|
configFromStringAndFormat(tempConfig);
|
1255
1266
|
|
@@ -1258,12 +1269,12 @@
|
|
1258
1269
|
}
|
1259
1270
|
|
1260
1271
|
// if there is any input that was not parsed add a penalty for that format
|
1261
|
-
currentScore += tempConfig.
|
1272
|
+
currentScore += getParsingFlags(tempConfig).charsLeftOver;
|
1262
1273
|
|
1263
1274
|
//or tokens
|
1264
|
-
currentScore += tempConfig.
|
1275
|
+
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
|
1265
1276
|
|
1266
|
-
tempConfig.
|
1277
|
+
getParsingFlags(tempConfig).score = currentScore;
|
1267
1278
|
|
1268
1279
|
if (scoreToBeat == null || currentScore < scoreToBeat) {
|
1269
1280
|
scoreToBeat = currentScore;
|
@@ -1306,6 +1317,8 @@
|
|
1306
1317
|
configFromStringAndArray(config);
|
1307
1318
|
} else if (format) {
|
1308
1319
|
configFromStringAndFormat(config);
|
1320
|
+
} else if (isDate(input)) {
|
1321
|
+
config._d = input;
|
1309
1322
|
} else {
|
1310
1323
|
configFromInput(config);
|
1311
1324
|
}
|
@@ -1358,7 +1371,6 @@
|
|
1358
1371
|
c._i = input;
|
1359
1372
|
c._f = format;
|
1360
1373
|
c._strict = strict;
|
1361
|
-
c._pf = defaultParsingFlags();
|
1362
1374
|
|
1363
1375
|
return createFromConfig(c);
|
1364
1376
|
}
|
@@ -1932,6 +1944,9 @@
|
|
1932
1944
|
}
|
1933
1945
|
|
1934
1946
|
function from (time, withoutSuffix) {
|
1947
|
+
if (!this.isValid()) {
|
1948
|
+
return this.localeData().invalidDate();
|
1949
|
+
}
|
1935
1950
|
return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
|
1936
1951
|
}
|
1937
1952
|
|
@@ -1939,6 +1954,17 @@
|
|
1939
1954
|
return this.from(local__createLocal(), withoutSuffix);
|
1940
1955
|
}
|
1941
1956
|
|
1957
|
+
function to (time, withoutSuffix) {
|
1958
|
+
if (!this.isValid()) {
|
1959
|
+
return this.localeData().invalidDate();
|
1960
|
+
}
|
1961
|
+
return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
function toNow (withoutSuffix) {
|
1965
|
+
return this.to(local__createLocal(), withoutSuffix);
|
1966
|
+
}
|
1967
|
+
|
1942
1968
|
function locale (key) {
|
1943
1969
|
var newLocaleData;
|
1944
1970
|
|
@@ -2041,11 +2067,11 @@
|
|
2041
2067
|
}
|
2042
2068
|
|
2043
2069
|
function parsingFlags () {
|
2044
|
-
return extend({}, this
|
2070
|
+
return extend({}, getParsingFlags(this));
|
2045
2071
|
}
|
2046
2072
|
|
2047
2073
|
function invalidAt () {
|
2048
|
-
return this.
|
2074
|
+
return getParsingFlags(this).overflow;
|
2049
2075
|
}
|
2050
2076
|
|
2051
2077
|
addFormatToken(0, ['gg', 2], 0, function () {
|
@@ -2196,7 +2222,7 @@
|
|
2196
2222
|
if (weekday != null) {
|
2197
2223
|
week.d = weekday;
|
2198
2224
|
} else {
|
2199
|
-
config.
|
2225
|
+
getParsingFlags(config).invalidWeekday = input;
|
2200
2226
|
}
|
2201
2227
|
});
|
2202
2228
|
|
@@ -2321,7 +2347,7 @@
|
|
2321
2347
|
});
|
2322
2348
|
addParseToken(['h', 'hh'], function (input, array, config) {
|
2323
2349
|
array[HOUR] = toInt(input);
|
2324
|
-
config.
|
2350
|
+
getParsingFlags(config).bigHour = true;
|
2325
2351
|
});
|
2326
2352
|
|
2327
2353
|
// LOCALES
|
@@ -2438,6 +2464,8 @@
|
|
2438
2464
|
momentPrototype__proto.format = format;
|
2439
2465
|
momentPrototype__proto.from = from;
|
2440
2466
|
momentPrototype__proto.fromNow = fromNow;
|
2467
|
+
momentPrototype__proto.to = to;
|
2468
|
+
momentPrototype__proto.toNow = toNow;
|
2441
2469
|
momentPrototype__proto.get = getSet;
|
2442
2470
|
momentPrototype__proto.invalidAt = invalidAt;
|
2443
2471
|
momentPrototype__proto.isAfter = isAfter;
|
@@ -2626,7 +2654,7 @@
|
|
2626
2654
|
}
|
2627
2655
|
// Lenient ordinal parsing accepts just a number in addition to
|
2628
2656
|
// number + (possibly) stuff coming from _ordinalParseLenient.
|
2629
|
-
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + /\d{1,2}
|
2657
|
+
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
|
2630
2658
|
}
|
2631
2659
|
|
2632
2660
|
var prototype__proto = Locale.prototype;
|
@@ -2843,13 +2871,13 @@
|
|
2843
2871
|
// handle milliseconds separately because of floating point math errors (issue #1867)
|
2844
2872
|
days = this._days + Math.round(yearsToDays(this._months / 12));
|
2845
2873
|
switch (units) {
|
2846
|
-
case 'week' : return days / 7
|
2847
|
-
case 'day' : return days
|
2848
|
-
case 'hour' : return days * 24
|
2849
|
-
case 'minute' : return days *
|
2850
|
-
case 'second' : return days *
|
2874
|
+
case 'week' : return days / 7 + milliseconds / 6048e5;
|
2875
|
+
case 'day' : return days + milliseconds / 864e5;
|
2876
|
+
case 'hour' : return days * 24 + milliseconds / 36e5;
|
2877
|
+
case 'minute' : return days * 1440 + milliseconds / 6e4;
|
2878
|
+
case 'second' : return days * 86400 + milliseconds / 1000;
|
2851
2879
|
// Math.floor prevents floating point math errors here
|
2852
|
-
case 'millisecond': return Math.floor(days *
|
2880
|
+
case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
|
2853
2881
|
default: throw new Error('Unknown unit ' + units);
|
2854
2882
|
}
|
2855
2883
|
}
|
@@ -3050,7 +3078,7 @@
|
|
3050
3078
|
// Side effect imports
|
3051
3079
|
|
3052
3080
|
|
3053
|
-
utils_hooks__hooks.version = '2.10.
|
3081
|
+
utils_hooks__hooks.version = '2.10.3';
|
3054
3082
|
|
3055
3083
|
setHookCallback(local__createLocal);
|
3056
3084
|
|
@@ -3080,4 +3108,4 @@
|
|
3080
3108
|
|
3081
3109
|
return _moment;
|
3082
3110
|
|
3083
|
-
}));
|
3111
|
+
}));
|