summaryrefslogtreecommitdiffstats
path: root/js/vendor/momentjs/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/momentjs/src/lib')
-rw-r--r--js/vendor/momentjs/src/lib/create/check-overflow.js34
-rw-r--r--js/vendor/momentjs/src/lib/create/date-from-array.js21
-rw-r--r--js/vendor/momentjs/src/lib/create/from-anything.js101
-rw-r--r--js/vendor/momentjs/src/lib/create/from-array.js136
-rw-r--r--js/vendor/momentjs/src/lib/create/from-object.js16
-rw-r--r--js/vendor/momentjs/src/lib/create/from-string-and-array.js50
-rw-r--r--js/vendor/momentjs/src/lib/create/from-string-and-format.js104
-rw-r--r--js/vendor/momentjs/src/lib/create/from-string.js120
-rw-r--r--js/vendor/momentjs/src/lib/create/local.js5
-rw-r--r--js/vendor/momentjs/src/lib/create/parsing-flags.js22
-rw-r--r--js/vendor/momentjs/src/lib/create/utc.js5
-rw-r--r--js/vendor/momentjs/src/lib/create/valid.js37
-rw-r--r--js/vendor/momentjs/src/lib/duration/abs.js18
-rw-r--r--js/vendor/momentjs/src/lib/duration/add-subtract.js21
-rw-r--r--js/vendor/momentjs/src/lib/duration/as.js55
-rw-r--r--js/vendor/momentjs/src/lib/duration/bubble.js61
-rw-r--r--js/vendor/momentjs/src/lib/duration/constructor.js41
-rw-r--r--js/vendor/momentjs/src/lib/duration/create.js117
-rw-r--r--js/vendor/momentjs/src/lib/duration/duration.js12
-rw-r--r--js/vendor/momentjs/src/lib/duration/get.js25
-rw-r--r--js/vendor/momentjs/src/lib/duration/humanize.js64
-rw-r--r--js/vendor/momentjs/src/lib/duration/iso-string.js52
-rw-r--r--js/vendor/momentjs/src/lib/duration/prototype.js48
-rw-r--r--js/vendor/momentjs/src/lib/format/format.js92
-rw-r--r--js/vendor/momentjs/src/lib/locale/calendar.js15
-rw-r--r--js/vendor/momentjs/src/lib/locale/constructor.js2
-rw-r--r--js/vendor/momentjs/src/lib/locale/en.js15
-rw-r--r--js/vendor/momentjs/src/lib/locale/formats.js23
-rw-r--r--js/vendor/momentjs/src/lib/locale/invalid.js5
-rw-r--r--js/vendor/momentjs/src/lib/locale/lists.js48
-rw-r--r--js/vendor/momentjs/src/lib/locale/locale.js35
-rw-r--r--js/vendor/momentjs/src/lib/locale/locales.js118
-rw-r--r--js/vendor/momentjs/src/lib/locale/ordinal.js7
-rw-r--r--js/vendor/momentjs/src/lib/locale/pre-post-format.js3
-rw-r--r--js/vendor/momentjs/src/lib/locale/prototype.js76
-rw-r--r--js/vendor/momentjs/src/lib/locale/relative.js29
-rw-r--r--js/vendor/momentjs/src/lib/locale/set.js16
-rw-r--r--js/vendor/momentjs/src/lib/moment/add-subtract.js52
-rw-r--r--js/vendor/momentjs/src/lib/moment/calendar.js21
-rw-r--r--js/vendor/momentjs/src/lib/moment/clone.js5
-rw-r--r--js/vendor/momentjs/src/lib/moment/compare.js57
-rw-r--r--js/vendor/momentjs/src/lib/moment/constructor.js74
-rw-r--r--js/vendor/momentjs/src/lib/moment/creation-data.js9
-rw-r--r--js/vendor/momentjs/src/lib/moment/diff.js61
-rw-r--r--js/vendor/momentjs/src/lib/moment/format.js28
-rw-r--r--js/vendor/momentjs/src/lib/moment/from.js17
-rw-r--r--js/vendor/momentjs/src/lib/moment/get-set.js43
-rw-r--r--js/vendor/momentjs/src/lib/moment/locale.js34
-rw-r--r--js/vendor/momentjs/src/lib/moment/min-max.js63
-rw-r--r--js/vendor/momentjs/src/lib/moment/moment.js28
-rw-r--r--js/vendor/momentjs/src/lib/moment/now.js3
-rw-r--r--js/vendor/momentjs/src/lib/moment/prototype.js149
-rw-r--r--js/vendor/momentjs/src/lib/moment/start-end-of.js52
-rw-r--r--js/vendor/momentjs/src/lib/moment/to-type.js34
-rw-r--r--js/vendor/momentjs/src/lib/moment/to.js17
-rw-r--r--js/vendor/momentjs/src/lib/moment/valid.js15
-rw-r--r--js/vendor/momentjs/src/lib/parse/regex.js54
-rw-r--r--js/vendor/momentjs/src/lib/parse/token.js32
-rw-r--r--js/vendor/momentjs/src/lib/units/aliases.js29
-rw-r--r--js/vendor/momentjs/src/lib/units/constants.js9
-rw-r--r--js/vendor/momentjs/src/lib/units/day-of-month.js32
-rw-r--r--js/vendor/momentjs/src/lib/units/day-of-week.js162
-rw-r--r--js/vendor/momentjs/src/lib/units/day-of-year.js32
-rw-r--r--js/vendor/momentjs/src/lib/units/hour.js129
-rw-r--r--js/vendor/momentjs/src/lib/units/millisecond.js64
-rw-r--r--js/vendor/momentjs/src/lib/units/minute.js24
-rw-r--r--js/vendor/momentjs/src/lib/units/month.js209
-rw-r--r--js/vendor/momentjs/src/lib/units/offset.js219
-rw-r--r--js/vendor/momentjs/src/lib/units/quarter.js27
-rw-r--r--js/vendor/momentjs/src/lib/units/second.js24
-rw-r--r--js/vendor/momentjs/src/lib/units/timestamp.js20
-rw-r--r--js/vendor/momentjs/src/lib/units/timezone.js16
-rw-r--r--js/vendor/momentjs/src/lib/units/units.js20
-rw-r--r--js/vendor/momentjs/src/lib/units/week-calendar-utils.js65
-rw-r--r--js/vendor/momentjs/src/lib/units/week-year.js101
-rw-r--r--js/vendor/momentjs/src/lib/units/week.js61
-rw-r--r--js/vendor/momentjs/src/lib/units/year.js70
-rw-r--r--js/vendor/momentjs/src/lib/utils/abs-ceil.js7
-rw-r--r--js/vendor/momentjs/src/lib/utils/abs-floor.js7
-rw-r--r--js/vendor/momentjs/src/lib/utils/compare-arrays.js16
-rw-r--r--js/vendor/momentjs/src/lib/utils/defaults.js10
-rw-r--r--js/vendor/momentjs/src/lib/utils/deprecate.js33
-rw-r--r--js/vendor/momentjs/src/lib/utils/extend.js19
-rw-r--r--js/vendor/momentjs/src/lib/utils/has-own-prop.js3
-rw-r--r--js/vendor/momentjs/src/lib/utils/hooks.js13
-rw-r--r--js/vendor/momentjs/src/lib/utils/is-array.js3
-rw-r--r--js/vendor/momentjs/src/lib/utils/is-date.js3
-rw-r--r--js/vendor/momentjs/src/lib/utils/is-function.js3
-rw-r--r--js/vendor/momentjs/src/lib/utils/is-undefined.js3
-rw-r--r--js/vendor/momentjs/src/lib/utils/map.js7
-rw-r--r--js/vendor/momentjs/src/lib/utils/to-int.js12
-rw-r--r--js/vendor/momentjs/src/lib/utils/zero-fill.js7
92 files changed, 3956 insertions, 0 deletions
diff --git a/js/vendor/momentjs/src/lib/create/check-overflow.js b/js/vendor/momentjs/src/lib/create/check-overflow.js
new file mode 100644
index 000000000..41b539fb7
--- /dev/null
+++ b/js/vendor/momentjs/src/lib/create/check-overflow.js
@@ -0,0 +1,34 @@
+import { daysInMonth } from '../units/month';
+import { YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND, WEEK, WEEKDAY } from '../units/constants';
+import getParsingFlags from '../create/parsing-flags';
+
+export default function checkOverflow (m) {
+ var overflow;
+ var a = m._a;
+
+ if (a && getParsingFlags(m).overflow === -2) {
+ overflow =
+ a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
+ a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
+ a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
+ a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
+ a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
+ a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
+ -1;
+
+ if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+ overflow = DATE;
+ }
+ if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
+ overflow = WEEK;
+ }
+ if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
+ overflow = WEEKDAY;
+ }
+
+ getParsingFlags(m).overflow = overflow;
+ }
+
+ return m;
+}
+
diff --git a/js/vendor/momentjs/src/lib/create/date-from-array.js b/js/vendor/momentjs/src/lib/create/date-from-array.js
new file mode 100644
index 000000000..180f55c71
--- /dev/null
+++ b/js/vendor/momentjs/src/lib/create/date-from-array.js
@@ -0,0 +1,21 @@
+export function createDate (y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
+ date.setFullYear(y);
+ }
+ return date;
+}
+
+export function createUTCDate (y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+}
diff --git a/js/vendor/momentjs/src/lib/create/from-anything.js b/js/vendor/momentjs/src/lib/create/from-anything.js
new file mode 100644
index 000000000..7b92587ec
--- /dev/null
+++ b/js/vendor/momentjs/src/lib/create/from-anything.js
@@ -0,0 +1,101 @@
+import isArray from '../utils/is-array';
+import isDate from '../utils/is-date';
+import map from '../utils/map';
+import { createInvalid } from './valid';
+import { Moment, isMoment } from '../moment/constructor';
+import { getLocale } from '../locale/locales';
+import { hooks } from '../utils/hooks';
+import checkOverflow from './check-overflow';
+import { isValid } from './valid';
+
+import { configFromStringAndArray } from './from-string-and-array';
+import { configFromStringAndFormat } from './from-string-and-format';
+import { configFromString } from './from-string';
+import { configFromArray } from './from-array';
+import { configFromObject } from './from-object';
+
+function createFromConfig (config) {
+ var res = new Moment(checkOverflow(prepareConfig(config)));
+ if (res._nextDay) {
+ // Adding is smart enough around DST
+ res.add(1, 'd');
+ res._nextDay = undefined;
+ }
+
+ return res;
+}
+
+export function prepareConfig (config) {
+ var input = config._i,
+ format = config._f;
+
+ config._locale = config._locale || getLocale(config._l);
+
+ if (input === null || (format === undefined && input === '')) {
+ return createInvalid({nullInput: true});
+ }
+
+ if (typeof input === 'string') {
+ config._i = input = config._locale.preparse(input);
+ }
+
+ if (isMoment(input)) {
+ return new Moment(checkOverflow(input));
+ } else if (isArray(format)) {
+ configFromStringAndArray(config);
+ } else if (format) {
+ configFromStringAndFormat(config);
+ } else if (isDate(input)) {
+ config._d = input;
+ } else {
+ configFromInput(config);
+ }
+
+ if (!isValid(config)) {
+ config._d = null;
+ }
+
+ return config;
+}
+
+function configFromInput(config) {
+ var input = config._i;
+ if (input === undefined) {
+ config._d = new Date(hooks.now());
+ } else if (isDate(input)) {
+ config._d = new Date(+input);
+ } else if (typeof input === 'string') {
+ configFromString(config);
+ } else if (isArray(input)) {
+ config._a = map(input.slice(0), function (obj) {
+ return parseInt(obj, 10);
+ });
+ configFromArray(config);
+ } else if (typeof(input) === 'object') {
+ configFromObject(config);
+ } else if (typeof(input) === 'number') {
+ // from milliseconds
+ config._d = new Date(input);
+ } else {
+ hooks.createFromInputFallback(config);
+ }
+}
+
+export function createLocalOrUTC (input, format, locale, strict, isUTC) {
+ var c = {};
+
+ if (typeof(locale) === 'boolean') {
+ strict = locale;
+ locale = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c._isAMomentObject = true;
+ c._useUTC = c._isUTC = isUTC;
+ c._l = locale;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+
+ return createFromConfig(c);
+}
diff --git a/js/vendor/momentjs/src/lib/create/from-array.js b/js/vendor/momentjs/src/lib/create/from-array.js
new file mode 100644
index 000000000..25dbc28fc
--- /dev/null
+++ b/js/vendor/momentjs/src/lib/create/from-array.js
@@ -0,0 +1,136 @@
+import { hooks } from '../utils/hooks';
+import { createDate, createUTCDate } from './date-from-array';
+import { daysInYear } from '../units/year';
+import { weekOfYear, weeksInYear, dayOfYearFromWeeks } from '../units/week-calendar-utils';
+import { YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND } from '../units/constants';
+import { createLocal } from './local';
+import defaults from '../utils/defaults';
+import getParsingFlags from './parsing-flags';
+
+function currentDateArray(config) {
+ // hooks is actually the exported moment object
+ var nowValue = new Date(hooks.now());
+ if (config._useUTC) {
+ return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
+ }
+ return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
+}
+