momentjs-rails 2.8.2 → 2.8.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 -0
- data/test/integration/navigation_test.rb +1 -1
- data/vendor/assets/javascripts/moment.js +69 -28
- data/vendor/assets/javascripts/moment/ar.js +55 -23
- data/vendor/assets/javascripts/moment/cs.js +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead75ba3769a872adc3b513d4357c43406cd2215
|
4
|
+
data.tar.gz: ccf7ff4f26ff1537e102819d44d8bc8c0de3408a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbdc519b366c35ae481c1cbae30e95db9591e80c09f7bbb8e162eb7956b8fee11708faf4b490defc01cb400dbd04574295a042adb057e5f08aa4e172fcf2408a
|
7
|
+
data.tar.gz: 54ca514cd991d5440902e5cc47e9621cedabb1c9baf17ef8ad3989e73edf227879c9bf06df81d7287b4d37d02e00488193f9286ae60c2f78a01e0b1f02a344f8
|
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.8.
|
27
|
+
momentjs-rails 2.8.3 == Moment.js 2.8.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
@@ -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\.8\.
|
11
|
+
assert_match(/VERSION = "2\.8\.3"/, @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.8.
|
2
|
+
//! version : 2.8.3
|
3
3
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
4
4
|
//! license : MIT
|
5
5
|
//! momentjs.com
|
@@ -10,7 +10,7 @@
|
|
10
10
|
************************************/
|
11
11
|
|
12
12
|
var moment,
|
13
|
-
VERSION = '2.8.
|
13
|
+
VERSION = '2.8.3',
|
14
14
|
// the global-scope this is NOT the global object in Node.js
|
15
15
|
globalScope = typeof global !== 'undefined' ? global : this,
|
16
16
|
oldGlobalMoment,
|
@@ -1493,6 +1493,9 @@
|
|
1493
1493
|
for (i = 0; i < config._f.length; i++) {
|
1494
1494
|
currentScore = 0;
|
1495
1495
|
tempConfig = copyConfig({}, config);
|
1496
|
+
if (config._useUTC != null) {
|
1497
|
+
tempConfig._useUTC = config._useUTC;
|
1498
|
+
}
|
1496
1499
|
tempConfig._pf = defaultParsingFlags();
|
1497
1500
|
tempConfig._f = config._f[i];
|
1498
1501
|
makeDateFromStringAndFormat(tempConfig);
|
@@ -1557,6 +1560,14 @@
|
|
1557
1560
|
}
|
1558
1561
|
}
|
1559
1562
|
|
1563
|
+
function map(arr, fn) {
|
1564
|
+
var res = [], i;
|
1565
|
+
for (i = 0; i < arr.length; ++i) {
|
1566
|
+
res.push(fn(arr[i], i));
|
1567
|
+
}
|
1568
|
+
return res;
|
1569
|
+
}
|
1570
|
+
|
1560
1571
|
function makeDateFromInput(config) {
|
1561
1572
|
var input = config._i, matched;
|
1562
1573
|
if (input === undefined) {
|
@@ -1568,7 +1579,9 @@
|
|
1568
1579
|
} else if (typeof input === 'string') {
|
1569
1580
|
makeDateFromString(config);
|
1570
1581
|
} else if (isArray(input)) {
|
1571
|
-
config._a = input.slice(0)
|
1582
|
+
config._a = map(input.slice(0), function (obj) {
|
1583
|
+
return parseInt(obj, 10);
|
1584
|
+
});
|
1572
1585
|
dateFromConfig(config);
|
1573
1586
|
} else if (typeof(input) === 'object') {
|
1574
1587
|
dateFromObject(config);
|
@@ -2123,7 +2136,7 @@
|
|
2123
2136
|
this._isUTC = false;
|
2124
2137
|
|
2125
2138
|
if (keepLocalTime) {
|
2126
|
-
this.add(this.
|
2139
|
+
this.add(this._dateTzOffset(), 'm');
|
2127
2140
|
}
|
2128
2141
|
}
|
2129
2142
|
return this;
|
@@ -2141,7 +2154,7 @@
|
|
2141
2154
|
diff : function (input, units, asFloat) {
|
2142
2155
|
var that = makeAs(input, this),
|
2143
2156
|
zoneDiff = (this.zone() - that.zone()) * 6e4,
|
2144
|
-
diff, output;
|
2157
|
+
diff, output, daysAdjust;
|
2145
2158
|
|
2146
2159
|
units = normalizeUnits(units);
|
2147
2160
|
|
@@ -2152,11 +2165,12 @@
|
|
2152
2165
|
output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
|
2153
2166
|
// adjust by taking difference in days, average number of days
|
2154
2167
|
// and dst in the given months.
|
2155
|
-
|
2156
|
-
|
2168
|
+
daysAdjust = (this - moment(this).startOf('month')) -
|
2169
|
+
(that - moment(that).startOf('month'));
|
2157
2170
|
// same as above but with zones, to negate all dst
|
2158
|
-
|
2159
|
-
(that.zone() - moment(that).startOf('month').zone())) * 6e4
|
2171
|
+
daysAdjust -= ((this.zone() - moment(this).startOf('month').zone()) -
|
2172
|
+
(that.zone() - moment(that).startOf('month').zone())) * 6e4;
|
2173
|
+
output += daysAdjust / diff;
|
2160
2174
|
if (units === 'year') {
|
2161
2175
|
output = output / 12;
|
2162
2176
|
}
|
@@ -2265,18 +2279,33 @@
|
|
2265
2279
|
},
|
2266
2280
|
|
2267
2281
|
isAfter: function (input, units) {
|
2268
|
-
units = typeof units !== 'undefined' ? units : 'millisecond';
|
2269
|
-
|
2282
|
+
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
2283
|
+
if (units === 'millisecond') {
|
2284
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2285
|
+
return +this > +input;
|
2286
|
+
} else {
|
2287
|
+
return +this.clone().startOf(units) > +moment(input).startOf(units);
|
2288
|
+
}
|
2270
2289
|
},
|
2271
2290
|
|
2272
2291
|
isBefore: function (input, units) {
|
2273
|
-
units = typeof units !== 'undefined' ? units : 'millisecond';
|
2274
|
-
|
2292
|
+
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
2293
|
+
if (units === 'millisecond') {
|
2294
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2295
|
+
return +this < +input;
|
2296
|
+
} else {
|
2297
|
+
return +this.clone().startOf(units) < +moment(input).startOf(units);
|
2298
|
+
}
|
2275
2299
|
},
|
2276
2300
|
|
2277
2301
|
isSame: function (input, units) {
|
2278
|
-
units = units || '
|
2279
|
-
|
2302
|
+
units = normalizeUnits(units || 'millisecond');
|
2303
|
+
if (units === 'millisecond') {
|
2304
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2305
|
+
return +this === +input;
|
2306
|
+
} else {
|
2307
|
+
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
|
2308
|
+
}
|
2280
2309
|
},
|
2281
2310
|
|
2282
2311
|
min: deprecate(
|
@@ -2316,7 +2345,7 @@
|
|
2316
2345
|
input = input * 60;
|
2317
2346
|
}
|
2318
2347
|
if (!this._isUTC && keepLocalTime) {
|
2319
|
-
localAdjust = this.
|
2348
|
+
localAdjust = this._dateTzOffset();
|
2320
2349
|
}
|
2321
2350
|
this._offset = input;
|
2322
2351
|
this._isUTC = true;
|
@@ -2334,7 +2363,7 @@
|
|
2334
2363
|
}
|
2335
2364
|
}
|
2336
2365
|
} else {
|
2337
|
-
return this._isUTC ? offset : this.
|
2366
|
+
return this._isUTC ? offset : this._dateTzOffset();
|
2338
2367
|
}
|
2339
2368
|
return this;
|
2340
2369
|
},
|
@@ -2438,10 +2467,15 @@
|
|
2438
2467
|
// instance. Otherwise, it will return the locale configuration
|
2439
2468
|
// variables for this instance.
|
2440
2469
|
locale : function (key) {
|
2470
|
+
var newLocaleData;
|
2471
|
+
|
2441
2472
|
if (key === undefined) {
|
2442
2473
|
return this._locale._abbr;
|
2443
2474
|
} else {
|
2444
|
-
|
2475
|
+
newLocaleData = moment.localeData(key);
|
2476
|
+
if (newLocaleData != null) {
|
2477
|
+
this._locale = newLocaleData;
|
2478
|
+
}
|
2445
2479
|
return this;
|
2446
2480
|
}
|
2447
2481
|
},
|
@@ -2452,14 +2486,19 @@
|
|
2452
2486
|
if (key === undefined) {
|
2453
2487
|
return this.localeData();
|
2454
2488
|
} else {
|
2455
|
-
this.
|
2456
|
-
return this;
|
2489
|
+
return this.locale(key);
|
2457
2490
|
}
|
2458
2491
|
}
|
2459
2492
|
),
|
2460
2493
|
|
2461
2494
|
localeData : function () {
|
2462
2495
|
return this._locale;
|
2496
|
+
},
|
2497
|
+
|
2498
|
+
_dateTzOffset : function () {
|
2499
|
+
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
|
2500
|
+
// https://github.com/moment/moment/pull/1871
|
2501
|
+
return Math.round(this._d.getTimezoneOffset() / 15) * 15;
|
2463
2502
|
}
|
2464
2503
|
});
|
2465
2504
|
|
@@ -2657,19 +2696,21 @@
|
|
2657
2696
|
var days, months;
|
2658
2697
|
units = normalizeUnits(units);
|
2659
2698
|
|
2660
|
-
days = this._days + this._milliseconds / 864e5;
|
2661
2699
|
if (units === 'month' || units === 'year') {
|
2700
|
+
days = this._days + this._milliseconds / 864e5;
|
2662
2701
|
months = this._months + daysToYears(days) * 12;
|
2663
2702
|
return units === 'month' ? months : months / 12;
|
2664
2703
|
} else {
|
2665
|
-
|
2704
|
+
// handle milliseconds separately because of floating point math errors (issue #1867)
|
2705
|
+
days = this._days + yearsToDays(this._months / 12);
|
2666
2706
|
switch (units) {
|
2667
|
-
case 'week': return days / 7;
|
2668
|
-
case 'day': return days;
|
2669
|
-
case 'hour': return days * 24;
|
2670
|
-
case 'minute': return days * 24 * 60;
|
2671
|
-
case 'second': return days * 24 * 60 * 60;
|
2672
|
-
|
2707
|
+
case 'week': return days / 7 + this._milliseconds / 6048e5;
|
2708
|
+
case 'day': return days + this._milliseconds / 864e5;
|
2709
|
+
case 'hour': return days * 24 + this._milliseconds / 36e5;
|
2710
|
+
case 'minute': return days * 24 * 60 + this._milliseconds / 6e4;
|
2711
|
+
case 'second': return days * 24 * 60 * 60 + this._milliseconds / 1000;
|
2712
|
+
// Math.floor prevents floating point math errors here
|
2713
|
+
case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + this._milliseconds;
|
2673
2714
|
default: throw new Error('Unknown unit ' + units);
|
2674
2715
|
}
|
2675
2716
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
// moment.js locale configuration
|
2
|
-
//
|
3
|
-
//
|
4
|
-
//
|
2
|
+
// Locale: Arabic (ar)
|
3
|
+
// Author: Abdel Said: https://github.com/abdelsaid
|
4
|
+
// Changes in months, weekdays: Ahmed Elkhatib
|
5
|
+
// Native plural forms: forabi https://github.com/forabi
|
5
6
|
|
6
7
|
(function (factory) {
|
7
8
|
if (typeof define === 'function' && define.amd) {
|
@@ -34,11 +35,42 @@
|
|
34
35
|
'٨': '8',
|
35
36
|
'٩': '9',
|
36
37
|
'٠': '0'
|
37
|
-
}
|
38
|
+
}, pluralForm = function (n) {
|
39
|
+
return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
|
40
|
+
}, plurals = {
|
41
|
+
s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
|
42
|
+
m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
|
43
|
+
h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
|
44
|
+
d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
|
45
|
+
M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
|
46
|
+
y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
|
47
|
+
}, pluralize = function (u) {
|
48
|
+
return function (number, withoutSuffix, string, isFuture) {
|
49
|
+
var f = pluralForm(number),
|
50
|
+
str = plurals[u][pluralForm(number)];
|
51
|
+
if (f === 2) {
|
52
|
+
str = str[withoutSuffix ? 0 : 1];
|
53
|
+
}
|
54
|
+
return str.replace(/%d/i, number);
|
55
|
+
};
|
56
|
+
}, months = [
|
57
|
+
'كانون الثاني يناير',
|
58
|
+
'شباط فبراير',
|
59
|
+
'آذار مارس',
|
60
|
+
'نيسان أبريل',
|
61
|
+
'أيار مايو',
|
62
|
+
'حزيران يونيو',
|
63
|
+
'تموز يوليو',
|
64
|
+
'آب أغسطس',
|
65
|
+
'أيلول سبتمبر',
|
66
|
+
'تشرين الأول أكتوبر',
|
67
|
+
'تشرين الثاني نوفمبر',
|
68
|
+
'كانون الأول ديسمبر'
|
69
|
+
];
|
38
70
|
|
39
71
|
return moment.defineLocale('ar', {
|
40
|
-
months :
|
41
|
-
monthsShort :
|
72
|
+
months : months,
|
73
|
+
monthsShort : months,
|
42
74
|
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
|
43
75
|
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
|
44
76
|
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
|
@@ -57,27 +89,27 @@
|
|
57
89
|
}
|
58
90
|
},
|
59
91
|
calendar : {
|
60
|
-
sameDay: '[اليوم
|
61
|
-
nextDay: '[
|
62
|
-
nextWeek: 'dddd [
|
63
|
-
lastDay: '[أمس
|
64
|
-
lastWeek: 'dddd [
|
92
|
+
sameDay: '[اليوم عند الساعة] LT',
|
93
|
+
nextDay: '[غدًا عند الساعة] LT',
|
94
|
+
nextWeek: 'dddd [عند الساعة] LT',
|
95
|
+
lastDay: '[أمس عند الساعة] LT',
|
96
|
+
lastWeek: 'dddd [عند الساعة] LT',
|
65
97
|
sameElse: 'L'
|
66
98
|
},
|
67
99
|
relativeTime : {
|
68
|
-
future : '
|
100
|
+
future : 'بعد %s',
|
69
101
|
past : 'منذ %s',
|
70
|
-
s : '
|
71
|
-
m : '
|
72
|
-
mm : '
|
73
|
-
h : '
|
74
|
-
hh : '
|
75
|
-
d : '
|
76
|
-
dd : '
|
77
|
-
M : '
|
78
|
-
MM : '
|
79
|
-
y : '
|
80
|
-
yy : '
|
102
|
+
s : pluralize('s'),
|
103
|
+
m : pluralize('m'),
|
104
|
+
mm : pluralize('m'),
|
105
|
+
h : pluralize('h'),
|
106
|
+
hh : pluralize('h'),
|
107
|
+
d : pluralize('d'),
|
108
|
+
dd : pluralize('d'),
|
109
|
+
M : pluralize('M'),
|
110
|
+
MM : pluralize('M'),
|
111
|
+
y : pluralize('y'),
|
112
|
+
yy : pluralize('y')
|
81
113
|
},
|
82
114
|
preparse: function (string) {
|
83
115
|
return string.replace(/[۰-۹]/g, function (match) {
|