aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrateek Saxena <prtksxna@gmail.com>2014-04-16 18:25:42 +0530
committerNemo bis <federicoleva@tiscali.it>2014-04-17 13:39:22 +0000
commitb668c9d05db687404ba4f2ee512970855c74face (patch)
treeeacd72b7fa766a7cbf1287f1f85dde349c0169f6
parent45ee4e73524e1ee7899f9e11117a61a28c7eccc1 (diff)
downloadmediawikicore-b668c9d05db687404ba4f2ee512970855c74face.tar.gz
mediawikicore-b668c9d05db687404ba4f2ee512970855c74face.zip
Update moment.js to 2.6.0
From: https://github.com/moment/moment/commit/37808f3f9dec14e37ad2b5cff45c70f63b021d17 Bug: 63873 Change-Id: I471c0e47243b10b2db9367079e7e9c86995d5ef8
-rw-r--r--resources/Resources.php5
-rw-r--r--resources/lib/moment/LICENSE2
-rw-r--r--resources/lib/moment/lang/cs.js6
-rw-r--r--resources/lib/moment/lang/de.js2
-rw-r--r--resources/lib/moment/lang/es.js17
-rw-r--r--resources/lib/moment/lang/fi.js12
-rw-r--r--resources/lib/moment/lang/hu.js7
-rw-r--r--resources/lib/moment/lang/km.js55
-rw-r--r--resources/lib/moment/lang/lt.js2
-rw-r--r--resources/lib/moment/lang/nn.js16
-rw-r--r--resources/lib/moment/lang/pt-br.js14
-rw-r--r--resources/lib/moment/lang/pt.js10
-rw-r--r--resources/lib/moment/lang/ro.js2
-rw-r--r--resources/lib/moment/lang/rs.js139
-rw-r--r--resources/lib/moment/lang/ru.js2
-rw-r--r--resources/lib/moment/lang/sq.js12
-rw-r--r--resources/lib/moment/lang/sr-cyr.js106
-rw-r--r--resources/lib/moment/lang/sr.js106
-rw-r--r--resources/lib/moment/lang/vi.js (renamed from resources/lib/moment/lang/vn.js)4
-rw-r--r--resources/lib/moment/moment.js281
20 files changed, 519 insertions, 281 deletions
diff --git a/resources/Resources.php b/resources/Resources.php
index cea012aa986b..6608fcdcb2d3 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -691,11 +691,12 @@ return array(
'pt-br' => 'resources/lib/moment/lang/pt-br.js',
'pt' => 'resources/lib/moment/lang/pt.js',
'ro' => 'resources/lib/moment/lang/ro.js',
- 'rs' => 'resources/lib/moment/lang/rs.js',
'ru' => 'resources/lib/moment/lang/ru.js',
'sk' => 'resources/lib/moment/lang/sk.js',
'sl' => 'resources/lib/moment/lang/sl.js',
'sq' => 'resources/lib/moment/lang/sq.js',
+ 'sr-el' => 'resources/lib/moment/lang/sr.js',
+ 'sr-ec' => 'resources/lib/moment/lang/sr-cyr.js',
'sv' => 'resources/lib/moment/lang/sv.js',
'ta' => 'resources/lib/moment/lang/ta.js',
'th' => 'resources/lib/moment/lang/th.js',
@@ -705,7 +706,7 @@ return array(
'tzm' => 'resources/lib/moment/lang/tzm.js',
'uk' => 'resources/lib/moment/lang/uk.js',
'uz' => 'resources/lib/moment/lang/uz.js',
- 'vn' => 'resources/lib/moment/lang/vn.js',
+ 'vi' => 'resources/lib/moment/lang/vi.js',
'zh-cn' => 'resources/lib/moment/lang/zh-cn.js',
'zh-tw' => 'resources/lib/moment/lang/zh-tw.js',
),
diff --git a/resources/lib/moment/LICENSE b/resources/lib/moment/LICENSE
index b44e3a68ce1e..bd172467a6bc 100644
--- a/resources/lib/moment/LICENSE
+++ b/resources/lib/moment/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2013 Tim Wood, Iskren Chernev, Moment.js contributors
+Copyright (c) 2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/resources/lib/moment/lang/cs.js b/resources/lib/moment/lang/cs.js
index c1396cfbf689..cb79c9b3cfb1 100644
--- a/resources/lib/moment/lang/cs.js
+++ b/resources/lib/moment/lang/cs.js
@@ -22,7 +22,7 @@
var result = number + " ";
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
- return (withoutSuffix || isFuture) ? 'pár vteřin' : 'pár vteřinami';
+ return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami';
case 'm': // a minute / in a minute / a minute ago
return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
@@ -86,8 +86,8 @@
weekdaysShort : "ne_po_út_st_čt_pá_so".split("_"),
weekdaysMin : "ne_po_út_st_čt_pá_so".split("_"),
longDateFormat : {
- LT: "H:mm",
- L : "DD.MM.YYYY",
+ LT: "H.mm",
+ L : "DD. MM. YYYY",
LL : "D. MMMM YYYY",
LLL : "D. MMMM YYYY LT",
LLLL : "dddd D. MMMM YYYY LT"
diff --git a/resources/lib/moment/lang/de.js b/resources/lib/moment/lang/de.js
index 988f3288204c..86cd268774d6 100644
--- a/resources/lib/moment/lang/de.js
+++ b/resources/lib/moment/lang/de.js
@@ -33,7 +33,7 @@
weekdaysShort : "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
weekdaysMin : "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
longDateFormat : {
- LT: "H:mm [Uhr]",
+ LT: "HH:mm [Uhr]",
L : "DD.MM.YYYY",
LL : "D. MMMM YYYY",
LLL : "D. MMMM YYYY LT",
diff --git a/resources/lib/moment/lang/es.js b/resources/lib/moment/lang/es.js
index 0a38396d3ed5..67432ca3eac5 100644
--- a/resources/lib/moment/lang/es.js
+++ b/resources/lib/moment/lang/es.js
@@ -11,18 +11,27 @@
factory(window.moment); // Browser global
}
}(function (moment) {
+ var monthsShortDot = "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),
+ monthsShort = "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");
+
return moment.lang('es', {
months : "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),
- monthsShort : "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),
+ monthsShort : function (m, format) {
+ if (/-MMM-/.test(format)) {
+ return monthsShort[m.month()];
+ } else {
+ return monthsShortDot[m.month()];
+ }
+ },
weekdays : "domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),
weekdaysShort : "dom._lun._mar._mié._jue._vie._sáb.".split("_"),
weekdaysMin : "Do_Lu_Ma_Mi_Ju_Vi_Sá".split("_"),
longDateFormat : {
LT : "H:mm",
L : "DD/MM/YYYY",
- LL : "D [de] MMMM [de] YYYY",
- LLL : "D [de] MMMM [de] YYYY LT",
- LLLL : "dddd, D [de] MMMM [de] YYYY LT"
+ LL : "D [de] MMMM [del] YYYY",
+ LLL : "D [de] MMMM [del] YYYY LT",
+ LLLL : "dddd, D [de] MMMM [del] YYYY LT"
},
calendar : {
sameDay : function () {
diff --git a/resources/lib/moment/lang/fi.js b/resources/lib/moment/lang/fi.js
index 18529c10d539..49f477c08e9c 100644
--- a/resources/lib/moment/lang/fi.js
+++ b/resources/lib/moment/lang/fi.js
@@ -11,9 +11,9 @@
factory(window.moment); // Browser global
}
}(function (moment) {
- var numbers_past = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
- numbers_future = ['nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden',
- numbers_past[7], numbers_past[8], numbers_past[9]];
+ var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
+ numbersFuture = ['nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden',
+ numbersPast[7], numbersPast[8], numbersPast[9]];
function translate(number, withoutSuffix, key, isFuture) {
var result = "";
@@ -46,12 +46,12 @@
result = isFuture ? 'vuoden' : 'vuotta';
break;
}
- result = verbal_number(number, isFuture) + " " + result;
+ result = verbalNumber(number, isFuture) + " " + result;
return result;
}
- function verbal_number(number, isFuture) {
- return number < 10 ? (isFuture ? numbers_future[number] : numbers_past[number]) : number;
+ function verbalNumber(number, isFuture) {
+ return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number;
}
return moment.lang('fi', {
diff --git a/resources/lib/moment/lang/hu.js b/resources/lib/moment/lang/hu.js
index 4d84ebdf6be1..9833024cdb89 100644
--- a/resources/lib/moment/lang/hu.js
+++ b/resources/lib/moment/lang/hu.js
@@ -62,6 +62,13 @@
LLL : "YYYY. MMMM D., LT",
LLLL : "YYYY. MMMM D., dddd LT"
},
+ meridiem : function (hours, minutes, isLower) {
+ if (hours < 12) {
+ return isLower === true ? 'de' : 'DE';
+ } else {
+ return isLower === true ? 'du' : 'DU';
+ }
+ },
calendar : {
sameDay : '[ma] LT[-kor]',
nextDay : '[holnap] LT[-kor]',
diff --git a/resources/lib/moment/lang/km.js b/resources/lib/moment/lang/km.js
new file mode 100644
index 000000000000..0759c8f1d991
--- /dev/null
+++ b/resources/lib/moment/lang/km.js
@@ -0,0 +1,55 @@
+// moment.js language configuration
+// language : khmer (km)
+// author : Kruy Vanna : https://github.com/kruyvanna
+
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['moment'], factory); // AMD
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require('../moment')); // Node
+ } else {
+ factory(window.moment); // Browser global
+ }
+}(function (moment) {
+ return moment.lang('km', {
+ months: "មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),
+ monthsShort: "មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),
+ weekdays: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
+ weekdaysShort: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
+ weekdaysMin: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
+ longDateFormat: {
+ LT: "HH:mm",
+ L: "DD/MM/YYYY",
+ LL: "D MMMM YYYY",
+ LLL: "D MMMM YYYY LT",
+ LLLL: "dddd, D MMMM YYYY LT"
+ },
+ calendar: {
+ sameDay: '[ថ្ងៃនៈ ម៉ោង] LT',
+ nextDay: '[ស្អែក ម៉ោង] LT',
+ nextWeek: 'dddd [ម៉ោង] LT',
+ lastDay: '[ម្សិលមិញ ម៉ោង] LT',
+ lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
+ sameElse: 'L'
+ },
+ relativeTime: {
+ future: "%sទៀត",
+ past: "%sមុន",
+ s: "ប៉ុន្មានវិនាទី",
+ m: "មួយនាទី",
+ mm: "%d នាទី",
+ h: "មួយម៉ោង",
+ hh: "%d ម៉ោង",
+ d: "មួយថ្ងៃ",
+ dd: "%d ថ្ងៃ",
+ M: "មួយខែ",
+ MM: "%d ខែ",
+ y: "មួយឆ្នាំ",
+ yy: "%d ឆ្នាំ"
+ },
+ week: {
+ dow: 1, // Monday is the first day of the week.
+ doy: 4 // The week that contains Jan 4th is the first week of the year.
+ }
+ });
+}));
diff --git a/resources/lib/moment/lang/lt.js b/resources/lib/moment/lang/lt.js
index 1cf6457d20b1..3377375cd4b7 100644
--- a/resources/lib/moment/lang/lt.js
+++ b/resources/lib/moment/lang/lt.js
@@ -61,7 +61,7 @@
}
function relativeWeekDay(moment, format) {
- var nominative = format.indexOf('dddd LT') === -1,
+ var nominative = format.indexOf('dddd HH:mm') === -1,
weekDay = weekDays[moment.weekday()];
return nominative ? weekDay : weekDay.substring(0, weekDay.length - 2) + "į";
diff --git a/resources/lib/moment/lang/nn.js b/resources/lib/moment/lang/nn.js
index f59c4153b43c..8c1510855db8 100644
--- a/resources/lib/moment/lang/nn.js
+++ b/resources/lib/moment/lang/nn.js
@@ -29,22 +29,22 @@
nextDay: '[I morgon klokka] LT',
nextWeek: 'dddd [klokka] LT',
lastDay: '[I går klokka] LT',
- lastWeek: '[Føregående] dddd [klokka] LT',
+ lastWeek: '[Føregåande] dddd [klokka] LT',
sameElse: 'L'
},
relativeTime : {
future : "om %s",
- past : "for %s siden",
- s : "noen sekund",
- m : "ett minutt",
+ past : "for %s sidan",
+ s : "nokre sekund",
+ m : "eit minutt",
mm : "%d minutt",
- h : "en time",
+ h : "ein time",
hh : "%d timar",
- d : "en dag",
+ d : "ein dag",
dd : "%d dagar",
- M : "en månad",
+ M : "ein månad",
MM : "%d månader",
- y : "ett år",
+ y : "eit år",
yy : "%d år"
},
ordinal : '%d.',
diff --git a/resources/lib/moment/lang/pt-br.js b/resources/lib/moment/lang/pt-br.js
index 5cac19b69160..8f142d19e796 100644
--- a/resources/lib/moment/lang/pt-br.js
+++ b/resources/lib/moment/lang/pt-br.js
@@ -12,17 +12,17 @@
}
}(function (moment) {
return moment.lang('pt-br', {
- months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
- monthsShort : "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
- weekdays : "Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),
- weekdaysShort : "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
- weekdaysMin : "Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),
+ months : "janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),
+ monthsShort : "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
+ weekdays : "domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),
+ weekdaysShort : "dom_seg_ter_qua_qui_sex_sáb".split("_"),
+ weekdaysMin : "dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),
longDateFormat : {
LT : "HH:mm",
L : "DD/MM/YYYY",
LL : "D [de] MMMM [de] YYYY",
- LLL : "D [de] MMMM [de] YYYY LT",
- LLLL : "dddd, D [de] MMMM [de] YYYY LT"
+ LLL : "D [de] MMMM [de] YYYY [às] LT",
+ LLLL : "dddd, D [de] MMMM [de] YYYY [às] LT"
},
calendar : {
sameDay: '[Hoje às] LT',
diff --git a/resources/lib/moment/lang/pt.js b/resources/lib/moment/lang/pt.js
index 7c1f2b5ce5a8..77e1cad31528 100644
--- a/resources/lib/moment/lang/pt.js
+++ b/resources/lib/moment/lang/pt.js
@@ -12,11 +12,11 @@
}
}(function (moment) {
return moment.lang('pt', {
- months : "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
- monthsShort : "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
- weekdays : "Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),
- weekdaysShort : "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
- weekdaysMin : "Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),
+ months : "janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),
+ monthsShort : "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
+ weekdays : "domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),
+ weekdaysShort : "dom_seg_ter_qua_qui_sex_sáb".split("_"),
+ weekdaysMin : "dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),
longDateFormat : {
LT : "HH:mm",
L : "DD/MM/YYYY",
diff --git a/resources/lib/moment/lang/ro.js b/resources/lib/moment/lang/ro.js
index 77d735558b1b..fc275099005c 100644
--- a/resources/lib/moment/lang/ro.js
+++ b/resources/lib/moment/lang/ro.js
@@ -30,7 +30,7 @@
return moment.lang('ro', {
months : "ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),
- monthsShort : "ian_feb_mar_apr_mai_iun_iul_aug_sep_oct_noi_dec".split("_"),
+ monthsShort : "ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),
weekdays : "duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),
weekdaysShort : "Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),
weekdaysMin : "Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),
diff --git a/resources/lib/moment/lang/rs.js b/resources/lib/moment/lang/rs.js
deleted file mode 100644
index 86275536e9eb..000000000000
--- a/resources/lib/moment/lang/rs.js
+++ /dev/null
@@ -1,139 +0,0 @@
-// moment.js language configuration
-// language : serbian (rs)
-// author : Limon Monte : https://github.com/limonte
-// based on (bs) translation by Nedim Cholich
-
-(function (factory) {
- if (typeof define === 'function' && define.amd) {
- define(['moment'], factory); // AMD
- } else if (typeof exports === 'object') {
- module.exports = factory(require('../moment')); // Node
- } else {
- factory(window.moment); // Browser global
- }
-}(function (moment) {
-
- function translate(number, withoutSuffix, key) {
- var result = number + " ";
- switch (key) {
- case 'm':
- return withoutSuffix ? 'jedna minuta' : 'jedne minute';
- case 'mm':
- if (number === 1) {
- result += 'minuta';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'minute';
- } else {
- result += 'minuta';
- }
- return result;
- case 'h':
- return withoutSuffix ? 'jedan sat' : 'jednog sata';
- case 'hh':
- if (number === 1) {
- result += 'sat';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'sata';
- } else {
- result += 'sati';
- }
- return result;
- case 'dd':
- if (number === 1) {
- result += 'dan';
- } else {
- result += 'dana';
- }
- return result;
- case 'MM':
- if (number === 1) {
- result += 'mesec';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'meseca';
- } else {
- result += 'meseci';
- }
- return result;
- case 'yy':
- if (number === 1) {
- result += 'godina';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'godine';
- } else {
- result += 'godina';
- }
- return result;
- }
- }
-
- return moment.lang('rs', {
- months : "januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),
- monthsShort : "jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),
- weekdays : "nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),
- weekdaysShort : "ned._pon._uto._sre._čet._pet._sub.".split("_"),
- weekdaysMin : "ne_po_ut_sr_če_pe_su".split("_"),
- longDateFormat : {
- LT : "H:mm",
- L : "DD. MM. YYYY",
- LL : "D. MMMM YYYY",
- LLL : "D. MMMM YYYY LT",
- LLLL : "dddd, D. MMMM YYYY LT"
- },
- calendar : {
- sameDay : '[danas u] LT',
- nextDay : '[sutra u] LT',
-
- nextWeek : function () {
- switch (this.day()) {
- case 0:
- return '[u] [nedelju] [u] LT';
- case 3:
- return '[u] [sredu] [u] LT';
- case 6:
- return '[u] [subotu] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[u] dddd [u] LT';
- }
- },
- lastDay : '[juče u] LT',
- lastWeek : function () {
- switch (this.day()) {
- case 0:
- case 3:
- return '[prošlu] dddd [u] LT';
- case 6:
- return '[prošle] [subote] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[prošli] dddd [u] LT';
- }
- },
- sameElse : 'L'
- },
- relativeTime : {
- future : "za %s",
- past : "pre %s",
- s : "par sekundi",
- m : translate,
- mm : translate,
- h : translate,
- hh : translate,
- d : "dan",
- dd : translate,
- M : "mesec",
- MM : translate,
- y : "godinu",
- yy : translate
- },
- ordinal : '%d.',
- week : {
- dow : 1, // Monday is the first day of the week.
- doy : 7 // The week that contains Jan 1st is the first week of the year.
- }
- });
-}));
diff --git a/resources/lib/moment/lang/ru.js b/resources/lib/moment/lang/ru.js
index 1d1816ce9ef5..ac5400da8a90 100644
--- a/resources/lib/moment/lang/ru.js
+++ b/resources/lib/moment/lang/ru.js
@@ -19,7 +19,7 @@
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
- 'mm': 'минута_минуты_минут',
+ 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
'hh': 'час_часа_часов',
'dd': 'день_дня_дней',
'MM': 'месяц_месяца_месяцев',
diff --git a/resources/lib/moment/lang/sq.js b/resources/lib/moment/lang/sq.js
index a5e44b5a5aa4..0d3cdcf7cb5c 100644
--- a/resources/lib/moment/lang/sq.js
+++ b/resources/lib/moment/lang/sq.js
@@ -2,6 +2,7 @@
// language : Albanian (sq)
// author : Flakërim Ismani : https://github.com/flakerimi
// author: Menelion Elensúle: https://github.com/Oire (tests)
+// author : Oerd Cukalla : https://github.com/oerd (fixes)
(function (factory) {
if (typeof define === 'function' && define.amd) {
@@ -15,9 +16,12 @@
return moment.lang('sq', {
months : "Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),
monthsShort : "Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),
- weekdays : "E Diel_E Hënë_E Marte_E Mërkure_E Enjte_E Premte_E Shtunë".split("_"),
+ weekdays : "E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),
weekdaysShort : "Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),
weekdaysMin : "D_H_Ma_Më_E_P_Sh".split("_"),
+ meridiem : function (hours, minutes, isLower) {
+ return hours < 12 ? 'PD' : 'MD';
+ },
longDateFormat : {
LT : "HH:mm",
L : "DD/MM/YYYY",
@@ -27,7 +31,7 @@
},
calendar : {
sameDay : '[Sot në] LT',
- nextDay : '[Neser në] LT',
+ nextDay : '[Nesër në] LT',
nextWeek : 'dddd [në] LT',
lastDay : '[Dje në] LT',
lastWeek : 'dddd [e kaluar në] LT',
@@ -35,9 +39,9 @@
},
relativeTime : {
future : "në %s",
- past : "%s me parë",
+ past : "%s më parë",
s : "disa sekonda",
- m : "një minut",
+ m : "një minutë",
mm : "%d minuta",
h : "një orë",
hh : "%d orë",
diff --git a/resources/lib/moment/lang/sr-cyr.js b/resources/lib/moment/lang/sr-cyr.js
new file mode 100644
index 000000000000..8d186890b839
--- /dev/null
+++ b/resources/lib/moment/lang/sr-cyr.js
@@ -0,0 +1,106 @@
+// moment.js language configuration
+// language : Serbian-cyrillic (sr-cyr)
+// author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
+
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['moment'], factory); // AMD
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require('../moment')); // Node
+ } else {
+ factory(window.moment); // Browser global
+ }
+}(function (moment) {
+
+ var translator = {
+ words: { //Different grammatical cases
+ m: ['један минут', 'једне минуте'],
+ mm: ['минут', 'минуте', 'минута'],
+ h: ['један сат', 'једног сата'],
+ hh: ['сат', 'сата', 'сати'],
+ dd: ['дан', 'дана', 'дана'],
+ MM: ['месец', 'месеца', 'месеци'],
+ yy: ['година', 'године', 'година']
+ },
+ correctGrammaticalCase: function (number, wordKey) {
+ return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
+ },
+ translate: function (number, withoutSuffix, key) {
+ var wordKey = translator.words[key];
+ if (key.length === 1) {
+ return withoutSuffix ? wordKey[0] : wordKey[1];
+ } else {
+ return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
+ }
+ }
+ };
+
+ return moment.lang('sr-cyr', {
+ months: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'],
+ monthsShort: ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'],
+ weekdays: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'],
+ weekdaysShort: ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'],
+ weekdaysMin: ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'],
+ longDateFormat: {
+ LT: "H:mm",
+ L: "DD. MM. YYYY",
+ LL: "D. MMMM YYYY",
+ LLL: "D. MMMM YYYY LT",
+ LLLL: "dddd, D. MMMM YYYY LT"
+ },
+ calendar: {
+ sameDay: '[данас у] LT',
+ nextDay: '[сутра у] LT',
+
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[у] [недељу] [у] LT';
+ case 3:
+ return '[у] [среду] [у] LT';
+ case 6:
+ return '[у] [суботу] [у] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[у] dddd [у] LT';
+ }
+ },
+ lastDay : '[јуче у] LT',
+ lastWeek : function () {
+ var lastWeekDays = [
+ '[прошле] [недеље] [у] LT',
+ '[прошлог] [понедељка] [у] LT',
+ '[прошлог] [уторка] [у] LT',
+ '[прошле] [среде] [у] LT',
+ '[прошлог] [четвртка] [у] LT',
+ '[прошлог] [петка] [у] LT',
+ '[прошле] [суботе] [у] LT'
+ ];
+ return lastWeekDays[this.day()];
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : "за %s",
+ past : "пре %s",
+ s : "неколико секунди",
+ m : translator.translate,
+ mm : translator.translate,
+ h : translator.translate,
+ hh : translator.translate,
+ d : "дан",
+ dd : translator.translate,
+ M : "месец",
+ MM : translator.translate,
+ y : "годину",
+ yy : translator.translate
+ },
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+}));
diff --git a/resources/lib/moment/lang/sr.js b/resources/lib/moment/lang/sr.js
new file mode 100644
index 000000000000..54a5f4f6e76e
--- /dev/null
+++ b/resources/lib/moment/lang/sr.js
@@ -0,0 +1,106 @@
+// moment.js language configuration
+// language : Serbian-latin (sr)
+// author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
+
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['moment'], factory); // AMD
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require('../moment')); // Node
+ } else {
+ factory(window.moment); // Browser global
+ }
+}(function (moment) {
+
+ var translator = {
+ words: { //Different grammatical cases
+ m: ['jedan minut', 'jedne minute'],
+ mm: ['minut', 'minute', 'minuta'],
+ h: ['jedan sat', 'jednog sata'],
+ hh: ['sat', 'sata', 'sati'],
+ dd: ['dan', 'dana', 'dana'],
+ MM: ['mesec', 'meseca', 'meseci'],
+ yy: ['godina', 'godine', 'godina']
+ },
+ correctGrammaticalCase: function (number, wordKey) {
+ return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
+ },
+ translate: function (number, withoutSuffix, key) {
+ var wordKey = translator.words[key];
+ if (key.length === 1) {
+ return withoutSuffix ? wordKey[0] : wordKey[1];
+ } else {
+ return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
+ }
+ }
+ };
+
+ return moment.lang('sr', {
+ months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
+ monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
+ weekdays: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
+ weekdaysShort: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
+ weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
+ longDateFormat: {
+ LT: "H:mm",
+ L: "DD. MM. YYYY",
+ LL: "D. MMMM YYYY",
+ LLL: "D. MMMM YYYY LT",
+ LLLL: "dddd, D. MMMM YYYY LT"
+ },
+ calendar: {
+ sameDay: '[danas u] LT',
+ nextDay: '[sutra u] LT',
+
+ nextWeek: function () {
+ switch (this.day()) {
+ case 0:
+ return '[u] [nedelju] [u] LT';
+ case 3:
+ return '[u] [sredu] [u] LT';
+ case 6:
+ return '[u] [subotu] [u] LT';
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ return '[u] dddd [u] LT';
+ }
+ },
+ lastDay : '[juče u] LT',
+ lastWeek : function () {
+ var lastWeekDays = [
+ '[prošle] [nedelje] [u] LT',
+ '[prošlog] [ponedeljka] [u] LT',
+ '[prošlog] [utorka] [u] LT',
+ '[prošle] [srede] [u] LT',
+ '[prošlog] [četvrtka] [u] LT',
+ '[prošlog] [petka] [u] LT',
+ '[prošle] [subote] [u] LT'
+ ];
+ return lastWeekDays[this.day()];
+ },
+ sameElse : 'L'
+ },
+ relativeTime : {
+ future : "za %s",
+ past : "pre %s",
+ s : "nekoliko sekundi",
+ m : translator.translate,
+ mm : translator.translate,
+ h : translator.translate,
+ hh : translator.translate,
+ d : "dan",
+ dd : translator.translate,
+ M : "mesec",
+ MM : translator.translate,
+ y : "godinu",
+ yy : translator.translate
+ },
+ ordinal : '%d.',
+ week : {
+ dow : 1, // Monday is the first day of the week.
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
+ }
+ });
+}));
diff --git a/resources/lib/moment/lang/vn.js b/resources/lib/moment/lang/vi.js
index f28e7c3b3a36..94890b03dc72 100644
--- a/resources/lib/moment/lang/vn.js
+++ b/resources/lib/moment/lang/vi.js
@@ -1,5 +1,5 @@
// moment.js language configuration
-// language : vietnamese (vn)
+// language : vietnamese (vi)
// author : Bang Nguyen : https://github.com/bangnk
(function (factory) {
@@ -11,7 +11,7 @@
factory(window.moment); // Browser global
}
}(function (moment) {
- return moment.lang('vn', {
+ return moment.lang('vi', {
months : "tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),
monthsShort : "Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),
weekdays : "chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),
diff --git a/resources/lib/moment/moment.js b/resources/lib/moment/moment.js
index b79da7f26046..257ee7ec1a54 100644
--- a/resources/lib/moment/moment.js
+++ b/resources/lib/moment/moment.js
@@ -1,5 +1,5 @@
//! moment.js
-//! version : 2.5.1
+//! version : 2.6.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
@@ -11,8 +11,10 @@
************************************/
var moment,
- VERSION = "2.5.1",
- global = this,
+ VERSION = "2.6.0",
+ // the global-scope this is NOT the global object in Node.js
+ globalScope = typeof global !== 'undefined' ? global : this,
+ oldGlobalMoment,
round = Math.round,
i,
@@ -41,7 +43,7 @@
},
// check for nodeJS
- hasModule = (typeof module !== 'undefined' && module.exports && typeof require !== 'undefined'),
+ hasModule = (typeof module !== 'undefined' && module.exports),
// ASP.NET json date format regex
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
@@ -52,7 +54,7 @@
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
// format tokens
- formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
+ 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|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
// parsing token regexes
@@ -65,6 +67,7 @@
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
parseTokenT = /T/i, // T (ISO separator)
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
+ parseTokenOrdinal = /\d{1,2}/,
//strict parsing regexes
parseTokenOneDigit = /\d/, // 0 - 9
@@ -90,7 +93,7 @@
// iso time formats and regexes
isoTimes = [
- ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/],
+ ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
['HH:mm', /(T| )\d\d:\d\d/],
['HH', /(T| )\d\d/]
@@ -121,6 +124,7 @@
w : 'week',
W : 'isoWeek',
M : 'month',
+ Q : 'quarter',
y : 'year',
DDD : 'dayOfYear',
e : 'weekday',
@@ -296,6 +300,23 @@
};
}
+ function deprecate(msg, fn) {
+ var firstTime = true;
+ function printMsg() {
+ if (moment.suppressDeprecationWarnings === false &&
+ typeof console !== 'undefined' && console.warn) {
+ console.warn("Deprecation warning: " + msg);
+ }
+ }
+ return extend(function () {
+ if (firstTime) {
+ printMsg();
+ firstTime = false;
+ }
+ return fn.apply(this, arguments);
+ }, fn);
+ }
+
function padToken(func, count) {
return function (a) {
return leftZeroFill(func.call(this, a), count);
@@ -336,6 +357,7 @@
function Duration(duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
+ quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
@@ -357,6 +379,7 @@
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
+ quarters * 3 +
years * 12;
this._data = {};
@@ -419,34 +442,23 @@
}
// helper function for _.addTime and _.subtractTime
- function addOrSubtractDurationFromMoment(mom, duration, isAdding, ignoreUpdateOffset) {
+ function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = duration._days,
- months = duration._months,
- minutes,
- hours;
+ months = duration._months;
+ updateOffset = updateOffset == null ? true : updateOffset;
if (milliseconds) {
mom._d.setTime(+mom._d + milliseconds * isAdding);
}
- // store the minutes and hours so we can restore them
- if (days || months) {
- minutes = mom.minute();
- hours = mom.hour();
- }
if (days) {
- mom.date(mom.date() + days * isAdding);
+ rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
}
if (months) {
- mom.month(mom.month() + months * isAdding);
+ rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
}
- if (milliseconds && !ignoreUpdateOffset) {
- moment.updateOffset(mom);
- }
- // restore the minutes and hours after possibly changing dst
- if (days || months) {
- mom.minute(minutes);
- mom.hour(hours);
+ if (updateOffset) {
+ moment.updateOffset(mom, days || months);
}
}
@@ -561,6 +573,10 @@
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
+ function weeksInYear(year, dow, doy) {
+ return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
+ }
+
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
@@ -951,6 +967,8 @@
function getParseRegexForToken(token, config) {
var a, strict = config._strict;
switch (token) {
+ case 'Q':
+ return parseTokenOneDigit;
case 'DDDD':
return parseTokenThreeDigits;
case 'YYYY':
@@ -1019,6 +1037,8 @@
case 'e':
case 'E':
return parseTokenOneOrTwoDigits;
+ case 'Do':
+ return parseTokenOrdinal;
default :
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i"));
return a;
@@ -1040,6 +1060,12 @@
var a, datePartArray = config._a;
switch (token) {
+ // QUARTER
+ case 'Q':
+ if (input != null) {
+ datePartArray[MONTH] = (toInt(input) - 1) * 3;
+ }
+ break;
// MONTH
case 'M' : // fall through to MM
case 'MM' :
@@ -1064,6 +1090,11 @@
datePartArray[DATE] = toInt(input);
}
break;
+ case 'Do' :
+ if (input != null) {
+ datePartArray[DATE] = toInt(parseInt(input, 10));
+ }
+ break;
// DAY OF YEAR
case 'DDD' : // fall through to DDDD
case 'DDDD' :
@@ -1074,7 +1105,7 @@
break;
// YEAR
case 'YY' :
- datePartArray[YEAR] = toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ datePartArray[YEAR] = moment.parseTwoDigitYear(input);
break;
case 'YYYY' :
case 'YYYYY' :
@@ -1163,9 +1194,9 @@
//compute day of the year from weeks and weekdays
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
fixYear = function (val) {
- var int_val = parseInt(val, 10);
+ var intVal = parseInt(val, 10);
return val ?
- (val.length < 3 ? (int_val > 68 ? 1900 + int_val : 2000 + int_val) : int_val) :
+ (val.length < 3 ? (intVal > 68 ? 1900 + intVal : 2000 + intVal) : intVal) :
(config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]);
};
@@ -1401,7 +1432,7 @@
makeDateFromStringAndFormat(config);
}
else {
- config._d = new Date(string);
+ moment.createFromInputFallback(config);
}
}
@@ -1422,8 +1453,11 @@
config._d = new Date(+input);
} else if (typeof(input) === 'object') {
dateFromObject(config);
- } else {
+ } else if (typeof(input) === 'number') {
+ // from milliseconds
config._d = new Date(input);
+ } else {
+ moment.createFromInputFallback(config);
}
}
@@ -1550,7 +1584,7 @@
var input = config._i,
format = config._f;
- if (input === null) {
+ if (input === null || (format === undefined && input === '')) {
return moment.invalid({nullInput: true});
}
@@ -1596,6 +1630,17 @@
return makeMoment(c);
};
+ moment.suppressDeprecationWarnings = false;
+
+ moment.createFromInputFallback = deprecate(
+ "moment construction falls back to js Date. This is " +
+ "discouraged and will be removed in upcoming major " +
+ "release. Please refer to " +
+ "https://github.com/moment/moment/issues/1407 for more info.",
+ function (config) {
+ config._d = new Date(config._i);
+ });
+
// creating with utc
moment.utc = function (input, format, lang, strict) {
var c;
@@ -1692,6 +1737,10 @@
// default format
moment.defaultFormat = isoFormat;
+ // Plugins that add properties should also add the key here (null value),
+ // so we can properly clone ourselves.
+ moment.momentProperties = momentProperties;
+
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
moment.updateOffset = function () {};
@@ -1755,8 +1804,12 @@
return m;
};
- moment.parseZone = function (input) {
- return moment(input).parseZone();
+ moment.parseZone = function () {
+ return moment.apply(null, arguments).parseZone();
+ };
+
+ moment.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
/************************************
@@ -1943,29 +1996,7 @@
}
},
- month : function (input) {
- var utc = this._isUTC ? 'UTC' : '',
- dayOfMonth;
-
- if (input != null) {
- if (typeof input === 'string') {
- input = this.lang().monthsParse(input);
- if (typeof input !== 'number') {
- return this;
- }
- }
-
- dayOfMonth = this.date();
- this.date(1);
- this._d['set' + utc + 'Month'](input);
- this.date(Math.min(dayOfMonth, this.daysInMonth()));
-
- moment.updateOffset(this);
- return this;
- } else {
- return this._d['get' + utc + 'Month']();
- }
- },
+ month : makeAccessor('Month', true),
startOf: function (units) {
units = normalizeUnits(units);
@@ -1975,6 +2006,7 @@
case 'year':
this.month(0);
/* falls through */
+ case 'quarter':
case 'month':
this.date(1);
/* falls through */
@@ -2001,6 +2033,11 @@
this.isoWeekday(1);
}
+ // quarters are also special
+ if (units === 'quarter') {
+ this.month(Math.floor(this.month() / 3) * 3);
+ }
+
return this;
},
@@ -2034,7 +2071,17 @@
return other > this ? this : other;
},
- zone : function (input) {
+ // keepTime = true means only change the timezone, without affecting
+ // the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200
+ // It is possible that 5:31:26 doesn't exist int zone +0200, so we
+ // adjust the time as needed, to be valid.
+ //
+ // Keeping the time actually adds/subtracts (one hour)
+ // from the actual represented time. That is why we call updateOffset
+ // a second time. In case it wants us to change the offset again
+ // _changeInProgress == true case, then we have to adjust, because
+ // there is no such time in the given timezone.
+ zone : function (input, keepTime) {
var offset = this._offset || 0;
if (input != null) {
if (typeof input === "string") {
@@ -2046,7 +2093,14 @@
this._offset = input;
this._isUTC = true;
if (offset !== input) {
- addOrSubtractDurationFromMoment(this, moment.duration(offset - input, 'm'), 1, true);
+ if (!keepTime || this._changeInProgress) {
+ addOrSubtractDurationFromMoment(this,
+ moment.duration(offset - input, 'm'), 1, false);
+ } else if (!this._changeInProgress) {
+ this._changeInProgress = true;
+ moment.updateOffset(this, true);
+ this._changeInProgress = null;
+ }
}
} else {
return this._isUTC ? offset : this._d.getTimezoneOffset();
@@ -2091,8 +2145,8 @@
return input == null ? dayOfYear : this.add("d", (input - dayOfYear));
},
- quarter : function () {
- return Math.ceil((this.month() + 1.0) / 3.0);
+ quarter : function (input) {
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
},
weekYear : function (input) {
@@ -2127,6 +2181,15 @@
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
},
+ isoWeeksInYear : function () {
+ return weeksInYear(this.year(), 1, 4);
+ },
+
+ weeksInYear : function () {
+ var weekInfo = this._lang._week;
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
+ },
+
get : function (units) {
units = normalizeUnits(units);
return this[units]();
@@ -2153,33 +2216,68 @@
}
});
- // helper for adding shortcuts
- function makeGetterAndSetter(name, key) {
- moment.fn[name] = moment.fn[name + 's'] = function (input) {
- var utc = this._isUTC ? 'UTC' : '';
- if (input != null) {
- this._d['set' + utc + key](input);
- moment.updateOffset(this);
+ function rawMonthSetter(mom, value) {
+ var dayOfMonth;
+
+ // TODO: Move this out of here!
+ if (typeof value === 'string') {
+ value = mom.lang().monthsParse(value);
+ // TODO: Another silent failure?
+ if (typeof value !== 'number') {
+ return mom;
+ }
+ }
+
+ dayOfMonth = Math.min(mom.date(),
+ daysInMonth(mom.year(), value));
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ return mom;
+ }
+
+ function rawGetter(mom, unit) {
+ return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
+ }
+
+ function rawSetter(mom, unit, value) {
+ if (unit === 'Month') {
+ return rawMonthSetter(mom, value);
+ } else {
+ return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+ }
+ }
+
+ function makeAccessor(unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ rawSetter(this, unit, value);
+ moment.updateOffset(this, keepTime);
return this;
} else {
- return this._d['get' + utc + key]();
+ return rawGetter(this, unit);
}
};
}
- // loop through and add shortcuts (Month, Date, Hours, Minutes, Seconds, Milliseconds)
- for (i = 0; i < proxyGettersAndSetters.length; i ++) {
- makeGetterAndSetter(proxyGettersAndSetters[i].toLowerCase().replace(/s$/, ''), proxyGettersAndSetters[i]);
- }
-
- // add shortcut for year (uses different syntax than the getter/setter 'year' == 'FullYear')
- makeGetterAndSetter('year', 'FullYear');
+ moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
+ moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
+ moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
+ // Setting the hour should keep the time, because the user explicitly
+ // specified which hour he wants. So trying to maintain the same hour (in
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
+ // this rule.
+ moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
+ // moment.fn.month is defined separately
+ moment.fn.date = makeAccessor('Date', true);
+ moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true));
+ moment.fn.year = makeAccessor('FullYear', true);
+ moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true));
// add plural methods
moment.fn.days = moment.fn.day;
moment.fn.months = moment.fn.month;
moment.fn.weeks = moment.fn.week;
moment.fn.isoWeeks = moment.fn.isoWeek;
+ moment.fn.quarters = moment.fn.quarter;
// add aliased format methods
moment.fn.toJSON = moment.fn.toISOString;
@@ -2355,45 +2453,36 @@
Exposing Moment
************************************/
- function makeGlobal(deprecate) {
- var warned = false, local_moment = moment;
+ function makeGlobal(shouldDeprecate) {
/*global ender:false */
if (typeof ender !== 'undefined') {
return;
}
- // here, `this` means `window` in the browser, or `global` on the server
- // add `moment` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode
- if (deprecate) {
- global.moment = function () {
- if (!warned && console && console.warn) {
- warned = true;
- console.warn(
- "Accessing Moment through the global scope is " +
- "deprecated, and will be removed in an upcoming " +
- "release.");
- }
- return local_moment.apply(null, arguments);
- };
- extend(global.moment, local_moment);
+ oldGlobalMoment = globalScope.moment;
+ if (shouldDeprecate) {
+ globalScope.moment = deprecate(
+ "Accessing Moment through the global scope is " +
+ "deprecated, and will be removed in an upcoming " +
+ "release.",
+ moment);
} else {
- global['moment'] = moment;
+ globalScope.moment = moment;
}
}
// CommonJS module is defined
if (hasModule) {
module.exports = moment;
- makeGlobal(true);
} else if (typeof define === "function" && define.amd) {
define("moment", function (require, exports, module) {
- if (module.config && module.config() && module.config().noGlobal !== true) {
- // If user provided noGlobal, he is aware of global
- makeGlobal(module.config().noGlobal === undefined);
+ if (module.config && module.config() && module.config().noGlobal === true) {
+ // release the global variable
+ globalScope.moment = oldGlobalMoment;
}
return moment;
});
+ makeGlobal(true);
} else {
makeGlobal();
}