PageRenderTime 28ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/Resources/moment.js

https://gitlab.com/intelij/pp_alloy_slidenav
JavaScript | 659 lines | 650 code | 9 blank | 0 comment | 43 complexity | a5e256e45c1f0da68f183f995accaaea MD5 | raw file
Possible License(s): Apache-2.0
  1. (function(e) {
  2. function O(e, t) {
  3. return function(n) {
  4. return j(e.call(this, n), t);
  5. };
  6. }
  7. function M(e) {
  8. return function(t) {
  9. return this.lang().ordinal(e.call(this, t));
  10. };
  11. }
  12. function _() {}
  13. function D(e) {
  14. H(this, e);
  15. }
  16. function P(e) {
  17. var t = this._data = {}, n = e.years || e.year || e.y || 0, r = e.months || e.month || e.M || 0, i = e.weeks || e.week || e.w || 0, s = e.days || e.day || e.d || 0, o = e.hours || e.hour || e.h || 0, u = e.minutes || e.minute || e.m || 0, a = e.seconds || e.second || e.s || 0, f = e.milliseconds || e.millisecond || e.ms || 0;
  18. this._milliseconds = f + 1e3 * a + 6e4 * u + 36e5 * o, this._days = s + 7 * i, this._months = r + 12 * n,
  19. t.milliseconds = f % 1e3, a += B(f / 1e3), t.seconds = a % 60, u += B(a / 60), t.minutes = u % 60,
  20. o += B(u / 60), t.hours = o % 24, s += B(o / 24), s += 7 * i, t.days = s % 30, r += B(s / 30),
  21. t.months = r % 12, n += B(r / 12), t.years = n;
  22. }
  23. function H(e, t) {
  24. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
  25. return e;
  26. }
  27. function B(e) {
  28. return 0 > e ? Math.ceil(e) : Math.floor(e);
  29. }
  30. function j(e, t) {
  31. var n = e + "";
  32. while (t > n.length) n = "0" + n;
  33. return n;
  34. }
  35. function F(e, t, n) {
  36. var o, r = t._milliseconds, i = t._days, s = t._months;
  37. r && e._d.setTime(+e + r * n), i && e.date(e.date() + i * n), s && (o = e.date(),
  38. e.date(1).month(e.month() + s * n).date(Math.min(o, e.daysInMonth())));
  39. }
  40. function I(e) {
  41. return "[object Array]" === Object.prototype.toString.call(e);
  42. }
  43. function q(e, t) {
  44. var s, n = Math.min(e.length, t.length), r = Math.abs(e.length - t.length), i = 0;
  45. for (s = 0; n > s; s++) ~~e[s] !== ~~t[s] && i++;
  46. return i + r;
  47. }
  48. function R(e, t) {
  49. return t.abbr = e, s[e] || (s[e] = new _()), s[e].set(t), s[e];
  50. }
  51. function U(e) {
  52. return e ? (!s[e] && o && require("./lang/" + e), s[e]) : t.fn._lang;
  53. }
  54. function z(e) {
  55. return e.match(/\[.*\]/) ? e.replace(/^\[|\]$/g, "") : e.replace(/\\/g, "");
  56. }
  57. function W(e) {
  58. var n, r, t = e.match(a);
  59. for (n = 0, r = t.length; r > n; n++) t[n] = A[t[n]] ? A[t[n]] : z(t[n]);
  60. return function(i) {
  61. var s = "";
  62. for (n = 0; r > n; n++) s += "function" == typeof t[n].call ? t[n].call(i, e) : t[n];
  63. return s;
  64. };
  65. }
  66. function X(e, t) {
  67. function r(t) {
  68. return e.lang().longDateFormat(t) || t;
  69. }
  70. var n = 5;
  71. while (n-- && f.test(t)) t = t.replace(f, r);
  72. return C[t] || (C[t] = W(t)), C[t](e);
  73. }
  74. function V(e) {
  75. switch (e) {
  76. case "DDDD":
  77. return p;
  78. case "YYYY":
  79. return d;
  80. case "YYYYY":
  81. return v;
  82. case "S":
  83. case "SS":
  84. case "SSS":
  85. case "DDD":
  86. return h;
  87. case "MMM":
  88. case "MMMM":
  89. case "dd":
  90. case "ddd":
  91. case "dddd":
  92. case "a":
  93. case "A":
  94. return m;
  95. case "X":
  96. return b;
  97. case "Z":
  98. case "ZZ":
  99. return g;
  100. case "T":
  101. return y;
  102. case "MM":
  103. case "DD":
  104. case "YY":
  105. case "HH":
  106. case "hh":
  107. case "mm":
  108. case "ss":
  109. case "M":
  110. case "D":
  111. case "d":
  112. case "H":
  113. case "h":
  114. case "m":
  115. case "s":
  116. return c;
  117. default:
  118. return new RegExp(e.replace("\\", ""));
  119. }
  120. }
  121. function $(e, t, n) {
  122. var r, s = n._a;
  123. switch (e) {
  124. case "M":
  125. case "MM":
  126. s[1] = null == t ? 0 : ~~t - 1;
  127. break;
  128. case "MMM":
  129. case "MMMM":
  130. r = U(n._l).monthsParse(t), null != r ? s[1] = r : n._isValid = !1;
  131. break;
  132. case "D":
  133. case "DD":
  134. case "DDD":
  135. case "DDDD":
  136. null != t && (s[2] = ~~t);
  137. break;
  138. case "YY":
  139. s[0] = ~~t + (~~t > 68 ? 1900 : 2e3);
  140. break;
  141. case "YYYY":
  142. case "YYYYY":
  143. s[0] = ~~t;
  144. break;
  145. case "a":
  146. case "A":
  147. n._isPm = "pm" === (t + "").toLowerCase();
  148. break;
  149. case "H":
  150. case "HH":
  151. case "h":
  152. case "hh":
  153. s[3] = ~~t;
  154. break;
  155. case "m":
  156. case "mm":
  157. s[4] = ~~t;
  158. break;
  159. case "s":
  160. case "ss":
  161. s[5] = ~~t;
  162. break;
  163. case "S":
  164. case "SS":
  165. case "SSS":
  166. s[6] = ~~(1e3 * ("0." + t));
  167. break;
  168. case "X":
  169. n._d = new Date(1e3 * parseFloat(t));
  170. break;
  171. case "Z":
  172. case "ZZ":
  173. n._useUTC = !0, r = (t + "").match(x), r && r[1] && (n._tzh = ~~r[1]), r && r[2] && (n._tzm = ~~r[2]),
  174. r && "+" === r[0] && (n._tzh = -n._tzh, n._tzm = -n._tzm);
  175. }
  176. null == t && (n._isValid = !1);
  177. }
  178. function J(e) {
  179. var t, n, r = [];
  180. if (e._d) return;
  181. for (t = 0; 7 > t; t++) e._a[t] = r[t] = null == e._a[t] ? 2 === t ? 1 : 0 : e._a[t];
  182. r[3] += e._tzh || 0, r[4] += e._tzm || 0, n = new Date(0), e._useUTC ? (n.setUTCFullYear(r[0], r[1], r[2]),
  183. n.setUTCHours(r[3], r[4], r[5], r[6])) : (n.setFullYear(r[0], r[1], r[2]), n.setHours(r[3], r[4], r[5], r[6])),
  184. e._d = n;
  185. }
  186. function K(e) {
  187. var r, i, t = e._f.match(a), n = e._i;
  188. e._a = [];
  189. for (r = 0; t.length > r; r++) i = (V(t[r]).exec(n) || [])[0], i && (n = n.slice(n.indexOf(i) + i.length)),
  190. A[t[r]] && $(t[r], i, e);
  191. e._isPm && 12 > e._a[3] && (e._a[3] += 12), e._isPm === !1 && 12 === e._a[3] && (e._a[3] = 0),
  192. J(e);
  193. }
  194. function Q(e) {
  195. var t, n, r, u, i = 99;
  196. while (e._f.length) {
  197. t = H({}, e), t._f = e._f.pop(), K(t), n = new D(t);
  198. if (n.isValid()) {
  199. r = n;
  200. break;
  201. }
  202. u = q(t._a, n.toArray()), i > u && (i = u, r = n);
  203. }
  204. H(e, r);
  205. }
  206. function G(e) {
  207. var t, n = e._i;
  208. if (w.exec(n)) {
  209. e._f = "YYYY-MM-DDT";
  210. for (t = 0; 4 > t; t++) if (S[t][1].exec(n)) {
  211. e._f += S[t][0];
  212. break;
  213. }
  214. g.exec(n) && (e._f += " Z"), K(e);
  215. } else e._d = new Date(n);
  216. }
  217. function Y(t) {
  218. var n = t._i, r = u.exec(n);
  219. n === e ? t._d = new Date() : r ? t._d = new Date(+r[1]) : "string" == typeof n ? G(t) : I(n) ? (t._a = n.slice(0),
  220. J(t)) : t._d = n instanceof Date ? new Date(+n) : new Date(n);
  221. }
  222. function Z(e, t, n, r, i) {
  223. return i.relativeTime(t || 1, !!n, e, r);
  224. }
  225. function et(e, t, n) {
  226. var i = r(Math.abs(e) / 1e3), s = r(i / 60), o = r(s / 60), u = r(o / 24), a = r(u / 365), f = 45 > i && [ "s", i ] || 1 === s && [ "m" ] || 45 > s && [ "mm", s ] || 1 === o && [ "h" ] || 22 > o && [ "hh", o ] || 1 === u && [ "d" ] || 25 >= u && [ "dd", u ] || 45 >= u && [ "M" ] || 345 > u && [ "MM", r(u / 30) ] || 1 === a && [ "y" ] || [ "yy", a ];
  227. return f[2] = t, f[3] = e > 0, f[4] = n, Z.apply({}, f);
  228. }
  229. function tt(e, n, r) {
  230. var i = r - n, s = r - e.day();
  231. return s > i && (s -= 7), i - 7 > s && (s += 7), Math.ceil(t(e).add("d", s).dayOfYear() / 7);
  232. }
  233. function nt(e) {
  234. var n = e._i, r = e._f;
  235. return null === n || "" === n ? null : ("string" == typeof n && (e._i = n = U().preparse(n)),
  236. t.isMoment(n) ? (e = H({}, n), e._d = new Date(+n._d)) : r ? I(r) ? Q(e) : K(e) : Y(e),
  237. new D(e));
  238. }
  239. function rt(e, n) {
  240. t.fn[e] = t.fn[e + "s"] = function(e) {
  241. var t = this._isUTC ? "UTC" : "";
  242. return null != e ? (this._d["set" + t + n](e), this) : this._d["get" + t + n]();
  243. };
  244. }
  245. function it(e) {
  246. t.duration.fn[e] = function() {
  247. return this._data[e];
  248. };
  249. }
  250. function st(e, n) {
  251. t.duration.fn["as" + e] = function() {
  252. return +this / n;
  253. };
  254. }
  255. var t, i, n = "2.0.0", r = Math.round, s = {}, o = "undefined" != typeof module && module.exports, u = /^\/?Date\((\-?\d+)/i, a = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g, f = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, c = /\d\d?/, h = /\d{1,3}/, p = /\d{3}/, d = /\d{1,4}/, v = /[+\-]?\d{1,6}/, m = /[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i, g = /Z|[\+\-]\d\d:?\d\d/i, y = /T/i, b = /[\+\-]?\d+(\.\d{1,3})?/, w = /^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/, E = "YYYY-MM-DDTHH:mm:ssZ", S = [ [ "HH:mm:ss.S", /(T| )\d\d:\d\d:\d\d\.\d{1,3}/ ], [ "HH:mm:ss", /(T| )\d\d:\d\d:\d\d/ ], [ "HH:mm", /(T| )\d\d:\d\d/ ], [ "HH", /(T| )\d\d/ ] ], x = /([\+\-]|\d\d)/gi, T = "Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"), N = {
  256. Milliseconds: 1,
  257. Seconds: 1e3,
  258. Minutes: 6e4,
  259. Hours: 36e5,
  260. Days: 864e5,
  261. Months: 2592e6,
  262. Years: 31536e6
  263. }, C = {}, k = "DDD w W M D d".split(" "), L = "M D H h m s w W".split(" "), A = {
  264. M: function() {
  265. return this.month() + 1;
  266. },
  267. MMM: function(e) {
  268. return this.lang().monthsShort(this, e);
  269. },
  270. MMMM: function(e) {
  271. return this.lang().months(this, e);
  272. },
  273. D: function() {
  274. return this.date();
  275. },
  276. DDD: function() {
  277. return this.dayOfYear();
  278. },
  279. d: function() {
  280. return this.day();
  281. },
  282. dd: function(e) {
  283. return this.lang().weekdaysMin(this, e);
  284. },
  285. ddd: function(e) {
  286. return this.lang().weekdaysShort(this, e);
  287. },
  288. dddd: function(e) {
  289. return this.lang().weekdays(this, e);
  290. },
  291. w: function() {
  292. return this.week();
  293. },
  294. W: function() {
  295. return this.isoWeek();
  296. },
  297. YY: function() {
  298. return j(this.year() % 100, 2);
  299. },
  300. YYYY: function() {
  301. return j(this.year(), 4);
  302. },
  303. YYYYY: function() {
  304. return j(this.year(), 5);
  305. },
  306. a: function() {
  307. return this.lang().meridiem(this.hours(), this.minutes(), !0);
  308. },
  309. A: function() {
  310. return this.lang().meridiem(this.hours(), this.minutes(), !1);
  311. },
  312. H: function() {
  313. return this.hours();
  314. },
  315. h: function() {
  316. return this.hours() % 12 || 12;
  317. },
  318. m: function() {
  319. return this.minutes();
  320. },
  321. s: function() {
  322. return this.seconds();
  323. },
  324. S: function() {
  325. return ~~(this.milliseconds() / 100);
  326. },
  327. SS: function() {
  328. return j(~~(this.milliseconds() / 10), 2);
  329. },
  330. SSS: function() {
  331. return j(this.milliseconds(), 3);
  332. },
  333. Z: function() {
  334. var e = -this.zone(), t = "+";
  335. return 0 > e && (e = -e, t = "-"), t + j(~~(e / 60), 2) + ":" + j(~~e % 60, 2);
  336. },
  337. ZZ: function() {
  338. var e = -this.zone(), t = "+";
  339. return 0 > e && (e = -e, t = "-"), t + j(~~(10 * e / 6), 4);
  340. },
  341. X: function() {
  342. return this.unix();
  343. }
  344. };
  345. while (k.length) i = k.pop(), A[i + "o"] = M(A[i]);
  346. while (L.length) i = L.pop(), A[i + i] = O(A[i], 2);
  347. A.DDDD = O(A.DDD, 3), _.prototype = {
  348. set: function(e) {
  349. var t, n;
  350. for (n in e) t = e[n], "function" == typeof t ? this[n] = t : this["_" + n] = t;
  351. },
  352. _months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
  353. months: function(e) {
  354. return this._months[e.month()];
  355. },
  356. _monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
  357. monthsShort: function(e) {
  358. return this._monthsShort[e.month()];
  359. },
  360. monthsParse: function(e) {
  361. var n, r, i;
  362. this._monthsParse || (this._monthsParse = []);
  363. for (n = 0; 12 > n; n++) {
  364. this._monthsParse[n] || (r = t([ 2e3, n ]), i = "^" + this.months(r, "") + "|^" + this.monthsShort(r, ""),
  365. this._monthsParse[n] = new RegExp(i.replace(".", ""), "i"));
  366. if (this._monthsParse[n].test(e)) return n;
  367. }
  368. },
  369. _weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
  370. weekdays: function(e) {
  371. return this._weekdays[e.day()];
  372. },
  373. _weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
  374. weekdaysShort: function(e) {
  375. return this._weekdaysShort[e.day()];
  376. },
  377. _weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
  378. weekdaysMin: function(e) {
  379. return this._weekdaysMin[e.day()];
  380. },
  381. _longDateFormat: {
  382. LT: "h:mm A",
  383. L: "MM/DD/YYYY",
  384. LL: "MMMM D YYYY",
  385. LLL: "MMMM D YYYY LT",
  386. LLLL: "dddd, MMMM D YYYY LT"
  387. },
  388. longDateFormat: function(e) {
  389. var t = this._longDateFormat[e];
  390. return !t && this._longDateFormat[e.toUpperCase()] && (t = this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function(e) {
  391. return e.slice(1);
  392. }), this._longDateFormat[e] = t), t;
  393. },
  394. meridiem: function(e, t, n) {
  395. return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM";
  396. },
  397. _calendar: {
  398. sameDay: "[Today at] LT",
  399. nextDay: "[Tomorrow at] LT",
  400. nextWeek: "dddd [at] LT",
  401. lastDay: "[Yesterday at] LT",
  402. lastWeek: "[last] dddd [at] LT",
  403. sameElse: "L"
  404. },
  405. calendar: function(e, t) {
  406. var n = this._calendar[e];
  407. return "function" == typeof n ? n.apply(t) : n;
  408. },
  409. _relativeTime: {
  410. future: "in %s",
  411. past: "%s ago",
  412. s: "a few seconds",
  413. m: "a minute",
  414. mm: "%d minutes",
  415. h: "an hour",
  416. hh: "%d hours",
  417. d: "a day",
  418. dd: "%d days",
  419. M: "a month",
  420. MM: "%d months",
  421. y: "a year",
  422. yy: "%d years"
  423. },
  424. relativeTime: function(e, t, n, r) {
  425. var i = this._relativeTime[n];
  426. return "function" == typeof i ? i(e, t, n, r) : i.replace(/%d/i, e);
  427. },
  428. pastFuture: function(e, t) {
  429. var n = this._relativeTime[e > 0 ? "future" : "past"];
  430. return "function" == typeof n ? n(t) : n.replace(/%s/i, t);
  431. },
  432. ordinal: function(e) {
  433. return this._ordinal.replace("%d", e);
  434. },
  435. _ordinal: "%d",
  436. preparse: function(e) {
  437. return e;
  438. },
  439. postformat: function(e) {
  440. return e;
  441. },
  442. week: function(e) {
  443. return tt(e, this._week.dow, this._week.doy);
  444. },
  445. _week: {
  446. dow: 0,
  447. doy: 6
  448. }
  449. }, t = function(e, t, n) {
  450. return nt({
  451. _i: e,
  452. _f: t,
  453. _l: n,
  454. _isUTC: !1
  455. });
  456. }, t.utc = function(e, t, n) {
  457. return nt({
  458. _useUTC: !0,
  459. _isUTC: !0,
  460. _l: n,
  461. _i: e,
  462. _f: t
  463. });
  464. }, t.unix = function(e) {
  465. return t(1e3 * e);
  466. }, t.duration = function(e, n) {
  467. var o, r = t.isDuration(e), i = "number" == typeof e, s = r ? e._data : i ? {} : e;
  468. return i && (n ? s[n] = e : s.milliseconds = e), o = new P(s), r && e.hasOwnProperty("_lang") && (o._lang = e._lang),
  469. o;
  470. }, t.version = n, t.defaultFormat = E, t.lang = function(e, n) {
  471. if (!e) return t.fn._lang._abbr;
  472. n ? R(e, n) : s[e] || U(e), t.duration.fn._lang = t.fn._lang = U(e);
  473. }, t.langData = function(e) {
  474. return e && e._lang && e._lang._abbr && (e = e._lang._abbr), U(e);
  475. }, t.isMoment = function(e) {
  476. return e instanceof D;
  477. }, t.isDuration = function(e) {
  478. return e instanceof P;
  479. }, t.fn = D.prototype = {
  480. clone: function() {
  481. return t(this);
  482. },
  483. valueOf: function() {
  484. return +this._d;
  485. },
  486. unix: function() {
  487. return Math.floor(+this._d / 1e3);
  488. },
  489. toString: function() {
  490. return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
  491. },
  492. toDate: function() {
  493. return this._d;
  494. },
  495. toJSON: function() {
  496. return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]");
  497. },
  498. toArray: function() {
  499. var e = this;
  500. return [ e.year(), e.month(), e.date(), e.hours(), e.minutes(), e.seconds(), e.milliseconds() ];
  501. },
  502. isValid: function() {
  503. return null == this._isValid && (this._isValid = this._a ? !q(this._a, (this._isUTC ? t.utc(this._a) : t(this._a)).toArray()) : !isNaN(this._d.getTime())),
  504. !!this._isValid;
  505. },
  506. utc: function() {
  507. return this._isUTC = !0, this;
  508. },
  509. local: function() {
  510. return this._isUTC = !1, this;
  511. },
  512. format: function(e) {
  513. var n = X(this, e || t.defaultFormat);
  514. return this.lang().postformat(n);
  515. },
  516. add: function(e, n) {
  517. var r;
  518. return r = "string" == typeof e ? t.duration(+n, e) : t.duration(e, n), F(this, r, 1),
  519. this;
  520. },
  521. subtract: function(e, n) {
  522. var r;
  523. return r = "string" == typeof e ? t.duration(+n, e) : t.duration(e, n), F(this, r, -1),
  524. this;
  525. },
  526. diff: function(e, n, r) {
  527. var o, u, i = this._isUTC ? t(e).utc() : t(e).local(), s = 6e4 * (this.zone() - i.zone());
  528. return n && (n = n.replace(/s$/, "")), "year" === n || "month" === n ? (o = 432e5 * (this.daysInMonth() + i.daysInMonth()),
  529. u = 12 * (this.year() - i.year()) + (this.month() - i.month()), u += (this - t(this).startOf("month") - (i - t(i).startOf("month"))) / o,
  530. "year" === n && (u /= 12)) : (o = this - i - s, u = "second" === n ? o / 1e3 : "minute" === n ? o / 6e4 : "hour" === n ? o / 36e5 : "day" === n ? o / 864e5 : "week" === n ? o / 6048e5 : o),
  531. r ? u : B(u);
  532. },
  533. from: function(e, n) {
  534. return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n);
  535. },
  536. fromNow: function(e) {
  537. return this.from(t(), e);
  538. },
  539. calendar: function() {
  540. var e = this.diff(t().startOf("day"), "days", !0), n = -6 > e ? "sameElse" : -1 > e ? "lastWeek" : 0 > e ? "lastDay" : 1 > e ? "sameDay" : 2 > e ? "nextDay" : 7 > e ? "nextWeek" : "sameElse";
  541. return this.format(this.lang().calendar(n, this));
  542. },
  543. isLeapYear: function() {
  544. var e = this.year();
  545. return 0 === e % 4 && 0 !== e % 100 || 0 === e % 400;
  546. },
  547. isDST: function() {
  548. return this.zone() < t([ this.year() ]).zone() || this.zone() < t([ this.year(), 5 ]).zone();
  549. },
  550. day: function(e) {
  551. var t = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  552. return null == e ? t : this.add({
  553. d: e - t
  554. });
  555. },
  556. startOf: function(e) {
  557. e = e.replace(/s$/, "");
  558. switch (e) {
  559. case "year":
  560. this.month(0);
  561. case "month":
  562. this.date(1);
  563. case "week":
  564. case "day":
  565. this.hours(0);
  566. case "hour":
  567. this.minutes(0);
  568. case "minute":
  569. this.seconds(0);
  570. case "second":
  571. this.milliseconds(0);
  572. }
  573. return "week" === e && this.day(0), this;
  574. },
  575. endOf: function(e) {
  576. return this.startOf(e).add(e.replace(/s?$/, "s"), 1).subtract("ms", 1);
  577. },
  578. isAfter: function(e, n) {
  579. return n = "undefined" != typeof n ? n : "millisecond", +this.clone().startOf(n) > +t(e).startOf(n);
  580. },
  581. isBefore: function(e, n) {
  582. return n = "undefined" != typeof n ? n : "millisecond", +this.clone().startOf(n) < +t(e).startOf(n);
  583. },
  584. isSame: function(e, n) {
  585. return n = "undefined" != typeof n ? n : "millisecond", +this.clone().startOf(n) === +t(e).startOf(n);
  586. },
  587. zone: function() {
  588. return this._isUTC ? 0 : this._d.getTimezoneOffset();
  589. },
  590. daysInMonth: function() {
  591. return t.utc([ this.year(), this.month() + 1, 0 ]).date();
  592. },
  593. dayOfYear: function(e) {
  594. var n = r((t(this).startOf("day") - t(this).startOf("year")) / 864e5) + 1;
  595. return null == e ? n : this.add("d", e - n);
  596. },
  597. isoWeek: function(e) {
  598. var t = tt(this, 1, 4);
  599. return null == e ? t : this.add("d", 7 * (e - t));
  600. },
  601. week: function(e) {
  602. var t = this.lang().week(this);
  603. return null == e ? t : this.add("d", 7 * (e - t));
  604. },
  605. lang: function(t) {
  606. return t === e ? this._lang : (this._lang = U(t), this);
  607. }
  608. };
  609. for (i = 0; T.length > i; i++) rt(T[i].toLowerCase().replace(/s$/, ""), T[i]);
  610. rt("year", "FullYear"), t.fn.days = t.fn.day, t.fn.weeks = t.fn.week, t.fn.isoWeeks = t.fn.isoWeek,
  611. t.duration.fn = P.prototype = {
  612. weeks: function() {
  613. return B(this.days() / 7);
  614. },
  615. valueOf: function() {
  616. return this._milliseconds + 864e5 * this._days + 2592e6 * this._months;
  617. },
  618. humanize: function(e) {
  619. var t = +this, n = et(t, !e, this.lang());
  620. return e && (n = this.lang().pastFuture(t, n)), this.lang().postformat(n);
  621. },
  622. lang: t.fn.lang
  623. };
  624. for (i in N) N.hasOwnProperty(i) && (st(i, N[i]), it(i.toLowerCase()));
  625. st("Weeks", 6048e5), t.lang("en", {
  626. ordinal: function(e) {
  627. var t = e % 10, n = 1 === ~~(e % 100 / 10) ? "th" : 1 === t ? "st" : 2 === t ? "nd" : 3 === t ? "rd" : "th";
  628. return e + n;
  629. }
  630. }), o && (module.exports = t), "undefined" == typeof ender && (this.moment = t),
  631. "function" == typeof define && define.amd && define("moment", [], function() {
  632. return t;
  633. });
  634. }).call(this);