aboutsummaryrefslogtreecommitdiffstats
path: root/library/moment/src/lib/locale
diff options
context:
space:
mode:
Diffstat (limited to 'library/moment/src/lib/locale')
-rw-r--r--library/moment/src/lib/locale/calendar.js13
-rw-r--r--library/moment/src/lib/locale/constructor.js2
-rw-r--r--library/moment/src/lib/locale/en.js15
-rw-r--r--library/moment/src/lib/locale/formats.js23
-rw-r--r--library/moment/src/lib/locale/invalid.js5
-rw-r--r--library/moment/src/lib/locale/lists.js48
-rw-r--r--library/moment/src/lib/locale/locale.js35
-rw-r--r--library/moment/src/lib/locale/locales.js117
-rw-r--r--library/moment/src/lib/locale/ordinal.js7
-rw-r--r--library/moment/src/lib/locale/pre-post-format.js3
-rw-r--r--library/moment/src/lib/locale/prototype.js70
-rw-r--r--library/moment/src/lib/locale/relative.js27
-rw-r--r--library/moment/src/lib/locale/set.js14
13 files changed, 0 insertions, 379 deletions
diff --git a/library/moment/src/lib/locale/calendar.js b/library/moment/src/lib/locale/calendar.js
deleted file mode 100644
index 22545b964..000000000
--- a/library/moment/src/lib/locale/calendar.js
+++ /dev/null
@@ -1,13 +0,0 @@
-export var defaultCalendar = {
- sameDay : '[Today at] LT',
- nextDay : '[Tomorrow at] LT',
- nextWeek : 'dddd [at] LT',
- lastDay : '[Yesterday at] LT',
- lastWeek : '[Last] dddd [at] LT',
- sameElse : 'L'
-};
-
-export function calendar (key, mom, now) {
- var output = this._calendar[key];
- return typeof output === 'function' ? output.call(mom, now) : output;
-}
diff --git a/library/moment/src/lib/locale/constructor.js b/library/moment/src/lib/locale/constructor.js
deleted file mode 100644
index 2c17b5d00..000000000
--- a/library/moment/src/lib/locale/constructor.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export function Locale() {
-}
diff --git a/library/moment/src/lib/locale/en.js b/library/moment/src/lib/locale/en.js
deleted file mode 100644
index 20964cd9c..000000000
--- a/library/moment/src/lib/locale/en.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import './prototype';
-import { getSetGlobalLocale } from './locales';
-import toInt from '../utils/to-int';
-
-getSetGlobalLocale('en', {
- ordinalParse: /\d{1,2}(th|st|nd|rd)/,
- ordinal : function (number) {
- var b = number % 10,
- output = (toInt(number % 100 / 10) === 1) ? 'th' :
- (b === 1) ? 'st' :
- (b === 2) ? 'nd' :
- (b === 3) ? 'rd' : 'th';
- return number + output;
- }
-});
diff --git a/library/moment/src/lib/locale/formats.js b/library/moment/src/lib/locale/formats.js
deleted file mode 100644
index 6d83b0394..000000000
--- a/library/moment/src/lib/locale/formats.js
+++ /dev/null
@@ -1,23 +0,0 @@
-export var defaultLongDateFormat = {
- LTS : 'h:mm:ss A',
- LT : 'h:mm A',
- L : 'MM/DD/YYYY',
- LL : 'MMMM D, YYYY',
- LLL : 'MMMM D, YYYY h:mm A',
- LLLL : 'dddd, MMMM D, YYYY h:mm A'
-};
-
-export function longDateFormat (key) {
- var format = this._longDateFormat[key],
- formatUpper = this._longDateFormat[key.toUpperCase()];
-
- if (format || !formatUpper) {
- return format;
- }
-
- this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
- return val.slice(1);
- });
-
- return this._longDateFormat[key];
-}
diff --git a/library/moment/src/lib/locale/invalid.js b/library/moment/src/lib/locale/invalid.js
deleted file mode 100644
index e9096339b..000000000
--- a/library/moment/src/lib/locale/invalid.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export var defaultInvalidDate = 'Invalid date';
-
-export function invalidDate () {
- return this._invalidDate;
-}
diff --git a/library/moment/src/lib/locale/lists.js b/library/moment/src/lib/locale/lists.js
deleted file mode 100644
index ea0161ab9..000000000
--- a/library/moment/src/lib/locale/lists.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import { getLocale } from './locales';
-import { createUTC } from '../create/utc';
-
-function get (format, index, field, setter) {
- var locale = getLocale();
- var utc = createUTC().set(setter, index);
- return locale[field](utc, format);
-}
-
-function list (format, index, field, count, setter) {
- if (typeof format === 'number') {
- index = format;
- format = undefined;
- }
-
- format = format || '';
-
- if (index != null) {
- return get(format, index, field, setter);
- }
-
- var i;
- var out = [];
- for (i = 0; i < count; i++) {
- out[i] = get(format, i, field, setter);
- }
- return out;
-}
-
-export function listMonths (format, index) {
- return list(format, index, 'months', 12, 'month');
-}
-
-export function listMonthsShort (format, index) {
- return list(format, index, 'monthsShort', 12, 'month');
-}
-
-export function listWeekdays (format, index) {
- return list(format, index, 'weekdays', 7, 'day');
-}
-
-export function listWeekdaysShort (format, index) {
- return list(format, index, 'weekdaysShort', 7, 'day');
-}
-
-export function listWeekdaysMin (format, index) {
- return list(format, index, 'weekdaysMin', 7, 'day');
-}
diff --git a/library/moment/src/lib/locale/locale.js b/library/moment/src/lib/locale/locale.js
deleted file mode 100644
index 2fc3c46ff..000000000
--- a/library/moment/src/lib/locale/locale.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Side effect imports
-import './prototype';
-
-import {
- getSetGlobalLocale,
- defineLocale,
- getLocale
-} from './locales';
-
-import {
- listMonths,
- listMonthsShort,
- listWeekdays,
- listWeekdaysShort,
- listWeekdaysMin
-} from './lists';
-
-export {
- getSetGlobalLocale,
- defineLocale,
- getLocale,
- listMonths,
- listMonthsShort,
- listWeekdays,
- listWeekdaysShort,
- listWeekdaysMin
-};
-
-import { deprecate } from '../utils/deprecate';
-import { hooks } from '../utils/hooks';
-
-hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
-hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
-
-import './en';
diff --git a/library/moment/src/lib/locale/locales.js b/library/moment/src/lib/locale/locales.js
deleted file mode 100644
index a32e5aced..000000000
--- a/library/moment/src/lib/locale/locales.js
+++ /dev/null
@@ -1,117 +0,0 @@
-import isArray from '../utils/is-array';
-import compareArrays from '../utils/compare-arrays';
-import { Locale } from './constructor';
-
-// internal storage for locale config files
-var locales = {};
-var globalLocale;
-
-function normalizeLocale(key) {
- return key ? key.toLowerCase().replace('_', '-') : key;
-}
-
-// pick the locale from the array
-// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
-// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
-function chooseLocale(names) {
- var i = 0, j, next, locale, split;
-
- while (i < names.length) {
- split = normalizeLocale(names[i]).split('-');
- j = split.length;
- next = normalizeLocale(names[i + 1]);
- next = next ? next.split('-') : null;
- while (j > 0) {
- locale = loadLocale(split.slice(0, j).join('-'));
- if (locale) {
- return locale;
- }
- if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
- //the next array item is better than a shallower substring of this one
- break;
- }
- j--;
- }
- i++;
- }
- return null;
-}
-
-function loadLocale(name) {
- var oldLocale = null;
- // TODO: Find a better way to register and load all the locales in Node
- if (!locales[name] && typeof module !== 'undefined' &&
- module && module.exports) {
- try {
- oldLocale = globalLocale._abbr;
- require('./locale/' + name);
- // because defineLocale currently also sets the global locale, we
- // want to undo that for lazy loaded locales
- getSetGlobalLocale(oldLocale);
- } catch (e) { }
- }
- return locales[name];
-}
-
-// This function will load locale and then set the global locale. If
-// no arguments are passed in, it will simply return the current global
-// locale key.
-export function getSetGlobalLocale (key, values) {
- var data;
- if (key) {
- if (typeof values === 'undefined') {
- data = getLocale(key);
- }
- else {
- data = defineLocale(key, values);
- }
-
- if (data) {
- // moment.duration._locale = moment._locale = data;
- globalLocale = data;
- }
- }
-
- return globalLocale._abbr;
-}
-
-export function defineLocale (name, values) {
- if (values !== null) {
- values.abbr = name;
- locales[name] = locales[name] || new Locale();
- locales[name].set(values);
-
- // backwards compat for now: also set the locale
- getSetGlobalLocale(name);
-
- return locales[name];
- } else {
- // useful for testing
- delete locales[name];
- return null;
- }
-}
-
-// returns locale data
-export function getLocale (key) {
- var locale;
-
- if (key && key._locale && key._locale._abbr) {
- key = key._locale._abbr;
- }
-
- if (!key) {
- return globalLocale;
- }
-
- if (!isArray(key)) {
- //short-circuit everything else
- locale = loadLocale(key);
- if (locale) {
- return locale;
- }
- key = [key];
- }
-
- return chooseLocale(key);
-}
diff --git a/library/moment/src/lib/locale/ordinal.js b/library/moment/src/lib/locale/ordinal.js
deleted file mode 100644
index 0028aca02..000000000
--- a/library/moment/src/lib/locale/ordinal.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export var defaultOrdinal = '%d';
-export var defaultOrdinalParse = /\d{1,2}/;
-
-export function ordinal (number) {
- return this._ordinal.replace('%d', number);
-}
-
diff --git a/library/moment/src/lib/locale/pre-post-format.js b/library/moment/src/lib/locale/pre-post-format.js
deleted file mode 100644
index 10ed20584..000000000
--- a/library/moment/src/lib/locale/pre-post-format.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export function preParsePostFormat (string) {
- return string;
-}
diff --git a/library/moment/src/lib/locale/prototype.js b/library/moment/src/lib/locale/prototype.js
deleted file mode 100644
index ed02d4f3b..000000000
--- a/library/moment/src/lib/locale/prototype.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import { Locale } from './constructor';
-
-var proto = Locale.prototype;
-
-import { defaultCalendar, calendar } from './calendar';
-import { defaultLongDateFormat, longDateFormat } from './formats';
-import { defaultInvalidDate, invalidDate } from './invalid';
-import { defaultOrdinal, ordinal, defaultOrdinalParse } from './ordinal';
-import { preParsePostFormat } from './pre-post-format';
-import { defaultRelativeTime, relativeTime, pastFuture } from './relative';
-import { set } from './set';
-
-proto._calendar = defaultCalendar;
-proto.calendar = calendar;
-proto._longDateFormat = defaultLongDateFormat;
-proto.longDateFormat = longDateFormat;
-proto._invalidDate = defaultInvalidDate;
-proto.invalidDate = invalidDate;
-proto._ordinal = defaultOrdinal;
-proto.ordinal = ordinal;
-proto._ordinalParse = defaultOrdinalParse;
-proto.preparse = preParsePostFormat;
-proto.postformat = preParsePostFormat;
-proto._relativeTime = defaultRelativeTime;
-proto.relativeTime = relativeTime;
-proto.pastFuture = pastFuture;
-proto.set = set;
-
-// Month
-import {
- localeMonthsParse,
- defaultLocaleMonths, localeMonths,
- defaultLocaleMonthsShort, localeMonthsShort
-} from '../units/month';
-
-proto.months = localeMonths;
-proto._months = defaultLocaleMonths;
-proto.monthsShort = localeMonthsShort;
-proto._monthsShort = defaultLocaleMonthsShort;
-proto.monthsParse = localeMonthsParse;
-
-// Week
-import { localeWeek, defaultLocaleWeek, localeFirstDayOfYear, localeFirstDayOfWeek } from '../units/week';
-proto.week = localeWeek;
-proto._week = defaultLocaleWeek;
-proto.firstDayOfYear = localeFirstDayOfYear;
-proto.firstDayOfWeek = localeFirstDayOfWeek;
-
-// Day of Week
-import {
- localeWeekdaysParse,
- defaultLocaleWeekdays, localeWeekdays,
- defaultLocaleWeekdaysMin, localeWeekdaysMin,
- defaultLocaleWeekdaysShort, localeWeekdaysShort
-} from '../units/day-of-week';
-
-proto.weekdays = localeWeekdays;
-proto._weekdays = defaultLocaleWeekdays;
-proto.weekdaysMin = localeWeekdaysMin;
-proto._weekdaysMin = defaultLocaleWeekdaysMin;
-proto.weekdaysShort = localeWeekdaysShort;
-proto._weekdaysShort = defaultLocaleWeekdaysShort;
-proto.weekdaysParse = localeWeekdaysParse;
-
-// Hours
-import { localeIsPM, defaultLocaleMeridiemParse, localeMeridiem } from '../units/hour';
-
-proto.isPM = localeIsPM;
-proto._meridiemParse = defaultLocaleMeridiemParse;
-proto.meridiem = localeMeridiem;
diff --git a/library/moment/src/lib/locale/relative.js b/library/moment/src/lib/locale/relative.js
deleted file mode 100644
index 5986a6754..000000000
--- a/library/moment/src/lib/locale/relative.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export var defaultRelativeTime = {
- future : 'in %s',
- past : '%s ago',
- s : 'a few seconds',
- m : 'a minute',
- mm : '%d minutes',
- h : 'an hour',
- hh : '%d hours',
- d : 'a day',
- dd : '%d days',
- M : 'a month',
- MM : '%d months',
- y : 'a year',
- yy : '%d years'
-};
-
-export function relativeTime (number, withoutSuffix, string, isFuture) {
- var output = this._relativeTime[string];
- return (typeof output === 'function') ?
- output(number, withoutSuffix, string, isFuture) :
- output.replace(/%d/i, number);
-}
-
-export function pastFuture (diff, output) {
- var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
- return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
-}
diff --git a/library/moment/src/lib/locale/set.js b/library/moment/src/lib/locale/set.js
deleted file mode 100644
index 32db2ad79..000000000
--- a/library/moment/src/lib/locale/set.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export function set (config) {
- var prop, i;
- for (i in config) {
- prop = config[i];
- if (typeof prop === 'function') {
- this[i] = prop;
- } else {
- this['_' + i] = prop;
- }
- }
- // Lenient ordinal parsing accepts just a number in addition to
- // number + (possibly) stuff coming from _ordinalParseLenient.
- this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
-}