1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2026-01-27 21:45:56 +00:00

Update bootstrap theme javascript dependencies

This commit is contained in:
James Hillyerd
2017-01-28 20:20:58 -08:00
parent 958f5a44d9
commit 9e49480482
383 changed files with 112654 additions and 79220 deletions

View File

@@ -1,4 +1,7 @@
import isArray from '../utils/is-array';
import isObject from '../utils/is-object';
import isObjectEmpty from '../utils/is-object-empty';
import isNumber from '../utils/is-number';
import isDate from '../utils/is-date';
import map from '../utils/map';
import { createInvalid } from './valid';
@@ -41,13 +44,13 @@ export function prepareConfig (config) {
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isDate(input)) {
config._d = input;
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (format) {
configFromStringAndFormat(config);
} else if (isDate(input)) {
config._d = input;
} else {
} else {
configFromInput(config);
}
@@ -63,7 +66,7 @@ function configFromInput(config) {
if (input === undefined) {
config._d = new Date(hooks.now());
} else if (isDate(input)) {
config._d = new Date(+input);
config._d = new Date(input.valueOf());
} else if (typeof input === 'string') {
configFromString(config);
} else if (isArray(input)) {
@@ -73,7 +76,7 @@ function configFromInput(config) {
configFromArray(config);
} else if (typeof(input) === 'object') {
configFromObject(config);
} else if (typeof(input) === 'number') {
} else if (isNumber(input)) {
// from milliseconds
config._d = new Date(input);
} else {
@@ -84,10 +87,15 @@ function configFromInput(config) {
export function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (typeof(locale) === 'boolean') {
if (locale === true || locale === false) {
strict = locale;
locale = undefined;
}
if ((isObject(input) && isObjectEmpty(input)) ||
(isArray(input) && input.length === 0)) {
input = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c._isAMomentObject = true;

View File

@@ -104,8 +104,12 @@ function dayOfYearFromWeekInfo(config) {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(createLocal(), dow, doy).year);
week = defaults(w.w, 1);
var curWeek = weekOfYear(createLocal(), dow, doy);
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
// Default to current week.
week = defaults(w.w, curWeek.week);
if (w.d != null) {
// weekday -- low day numbers are considered next week

View File

@@ -65,11 +65,14 @@ export function configFromStringAndFormat(config) {
}
// clear _12h flag if hour is <= 12
if (getParsingFlags(config).bigHour === true &&
config._a[HOUR] <= 12 &&
config._a[HOUR] > 0) {
if (config._a[HOUR] <= 12 &&
getParsingFlags(config).bigHour === true &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
}
getParsingFlags(config).parsedDateParts = config._a.slice(0);
getParsingFlags(config).meridiem = config._meridiem;
// handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);

View File

@@ -5,8 +5,8 @@ import getParsingFlags from './parsing-flags';
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
@@ -110,10 +110,10 @@ export function configFromString(config) {
}
hooks.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.',
'value provided is not in a recognized ISO format. moment construction falls back to js Date(), ' +
'which is not reliable across all browsers and versions. Non ISO date formats are ' +
'discouraged and will be removed in an upcoming major release. Please refer to ' +
'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
function (config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}

View File

@@ -10,7 +10,9 @@ function defaultParsingFlags() {
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false
iso : false,
parsedDateParts : [],
meridiem : null
};
}

View File

@@ -1,25 +1,37 @@
import extend from '../utils/extend';
import { createUTC } from './utc';
import getParsingFlags from '../create/parsing-flags';
import some from '../utils/some';
export function isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
m._isValid = !isNaN(m._d.getTime()) &&
var parsedParts = some.call(flags.parsedDateParts, function (i) {
return i != null;
});
var isNowValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.invalidWeekday &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated;
!flags.userInvalidated &&
(!flags.meridiem || (flags.meridiem && parsedParts));
if (m._strict) {
m._isValid = m._isValid &&
isNowValid = isNowValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
}
else {
return isNowValid;
}
}
return m._isValid;
}

View File

@@ -17,7 +17,7 @@ export function Duration (duration) {
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 36e5; // 1000 * 60 * 60
hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +

View File

@@ -1,16 +1,19 @@
import { Duration, isDuration } from './constructor';
import isNumber from '../utils/is-number';
import toInt from '../utils/to-int';
import absRound from '../utils/abs-round';
import hasOwnProp from '../utils/has-own-prop';
import { DATE, HOUR, MINUTE, SECOND, MILLISECOND } from '../units/constants';
import { cloneWithOffset } from '../units/offset';
import { createLocal } from '../create/local';
// ASP.NET json date format regex
var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/;
var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
var isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
// and further modified to allow for strings containing both week and day
var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
export function createDuration (input, key) {
var duration = input,
@@ -26,7 +29,7 @@ export function createDuration (input, key) {
d : input._days,
M : input._months
};
} else if (typeof input === 'number') {
} else if (isNumber(input)) {
duration = {};
if (key) {
duration[key] = input;
@@ -37,22 +40,22 @@ export function createDuration (input, key) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : 0,
d : toInt(match[DATE]) * sign,
h : toInt(match[HOUR]) * sign,
m : toInt(match[MINUTE]) * sign,
s : toInt(match[SECOND]) * sign,
ms : toInt(match[MILLISECOND]) * sign
d : toInt(match[DATE]) * sign,
h : toInt(match[HOUR]) * sign,
m : toInt(match[MINUTE]) * sign,
s : toInt(match[SECOND]) * sign,
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
};
} else if (!!(match = isoRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : parseIso(match[2], sign),
M : parseIso(match[3], sign),
d : parseIso(match[4], sign),
h : parseIso(match[5], sign),
m : parseIso(match[6], sign),
s : parseIso(match[7], sign),
w : parseIso(match[8], sign)
w : parseIso(match[4], sign),
d : parseIso(match[5], sign),
h : parseIso(match[6], sign),
m : parseIso(match[7], sign),
s : parseIso(match[8], sign)
};
} else if (duration == null) {// checks for null or undefined
duration = {};

View File

@@ -3,10 +3,14 @@ import './prototype';
import { createDuration } from './create';
import { isDuration } from './constructor';
import { getSetRelativeTimeThreshold } from './humanize';
import {
getSetRelativeTimeRounding,
getSetRelativeTimeThreshold
} from './humanize';
export {
createDuration,
isDuration,
getSetRelativeTimeRounding,
getSetRelativeTimeThreshold
};

View File

@@ -40,6 +40,18 @@ function relativeTime (posNegDuration, withoutSuffix, locale) {
return substituteTimeAgo.apply(null, a);
}
// This function allows you to set the rounding function for relative time strings
export function getSetRelativeTimeRounding (roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof(roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
}
// This function allows you to set a threshold for relative time strings
export function getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {

View File

@@ -1,6 +1,6 @@
import zeroFill from '../utils/zero-fill';
export var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
export var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
@@ -53,7 +53,7 @@ function makeFormatFunction(format) {
}
return function (mom) {
var output = '';
var output = '', i;
for (i = 0; i < length; i++) {
output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
}
@@ -89,4 +89,3 @@ export function expandFormat(format, locale) {
return format;
}

View File

@@ -0,0 +1,44 @@
import { defaultCalendar } from './calendar';
import { defaultLongDateFormat } from './formats';
import { defaultInvalidDate } from './invalid';
import { defaultOrdinal, defaultOrdinalParse } from './ordinal';
import { defaultRelativeTime } from './relative';
// months
import {
defaultLocaleMonths,
defaultLocaleMonthsShort,
} from '../units/month';
// week
import { defaultLocaleWeek } from '../units/week';
// weekdays
import {
defaultLocaleWeekdays,
defaultLocaleWeekdaysMin,
defaultLocaleWeekdaysShort,
} from '../units/day-of-week';
// meridiem
import { defaultLocaleMeridiemParse } from '../units/hour';
export var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
ordinalParse: defaultOrdinalParse,
relativeTime: defaultRelativeTime,
months: defaultLocaleMonths,
monthsShort: defaultLocaleMonthsShort,
week: defaultLocaleWeek,
weekdays: defaultLocaleWeekdays,
weekdaysMin: defaultLocaleWeekdaysMin,
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: defaultLocaleMeridiemParse
};

View File

@@ -10,6 +10,6 @@ export var defaultCalendar = {
import isFunction from '../utils/is-function';
export function calendar (key, mom, now) {
var output = this._calendar[key];
var output = this._calendar[key] || this._calendar['sameElse'];
return isFunction(output) ? output.call(mom, now) : output;
}

View File

@@ -1,2 +1,5 @@
export function Locale() {
export function Locale(config) {
if (config != null) {
this.set(config);
}
}

View File

@@ -1,3 +1,4 @@
import isNumber from '../utils/is-number';
import { getLocale } from './locales';
import { createUTC } from '../create/utc';
@@ -7,8 +8,8 @@ function get (format, index, field, setter) {
return locale[field](utc, format);
}
function list (format, index, field, count, setter) {
if (typeof format === 'number') {
function listMonthsImpl (format, index, field) {
if (isNumber(format)) {
index = format;
format = undefined;
}
@@ -16,33 +17,77 @@ function list (format, index, field, count, setter) {
format = format || '';
if (index != null) {
return get(format, index, field, setter);
return get(format, index, field, 'month');
}
var i;
var out = [];
for (i = 0; i < count; i++) {
out[i] = get(format, i, field, setter);
for (i = 0; i < 12; i++) {
out[i] = get(format, i, field, 'month');
}
return out;
}
// ()
// (5)
// (fmt, 5)
// (fmt)
// (true)
// (true, 5)
// (true, fmt, 5)
// (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) {
if (typeof localeSorted === 'boolean') {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
index = format;
localeSorted = false;
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
}
var locale = getLocale(),
shift = localeSorted ? locale._week.dow : 0;
if (index != null) {
return get(format, (index + shift) % 7, field, 'day');
}
var i;
var out = [];
for (i = 0; i < 7; i++) {
out[i] = get(format, (i + shift) % 7, field, 'day');
}
return out;
}
export function listMonths (format, index) {
return list(format, index, 'months', 12, 'month');
return listMonthsImpl(format, index, 'months');
}
export function listMonthsShort (format, index) {
return list(format, index, 'monthsShort', 12, 'month');
return listMonthsImpl(format, index, 'monthsShort');
}
export function listWeekdays (format, index) {
return list(format, index, 'weekdays', 7, 'day');
export function listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
}
export function listWeekdaysShort (format, index) {
return list(format, index, 'weekdaysShort', 7, 'day');
export function listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
}
export function listWeekdaysMin (format, index) {
return list(format, index, 'weekdaysMin', 7, 'day');
export function listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
}

View File

@@ -4,7 +4,9 @@ import './prototype';
import {
getSetGlobalLocale,
defineLocale,
getLocale
updateLocale,
getLocale,
listLocales
} from './locales';
import {
@@ -18,7 +20,9 @@ import {
export {
getSetGlobalLocale,
defineLocale,
updateLocale,
getLocale,
listLocales,
listMonths,
listMonthsShort,
listWeekdays,

View File

@@ -1,10 +1,17 @@
import isArray from '../utils/is-array';
import hasOwnProp from '../utils/has-own-prop';
import isUndefined from '../utils/is-undefined';
import compareArrays from '../utils/compare-arrays';
import { deprecateSimple } from '../utils/deprecate';
import { mergeConfigs } from './set';
import { Locale } from './constructor';
import keys from '../utils/keys';
import { baseConfig } from './base-config';
// internal storage for locale config files
var locales = {};
var localeFamilies = {};
var globalLocale;
function normalizeLocale(key) {
@@ -76,15 +83,45 @@ export function getSetGlobalLocale (key, values) {
return globalLocale._abbr;
}
export function defineLocale (name, values) {
if (values !== null) {
values.abbr = name;
locales[name] = locales[name] || new Locale();
locales[name].set(values);
export function defineLocale (name, config) {
if (config !== null) {
var parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple('defineLocaleOverride',
'use moment.updateLocale(localeName, config) to change ' +
'an existing locale. moment.defineLocale(localeName, ' +
'config) should only be used for creating a new locale ' +
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
parentConfig = locales[name]._config;
} else if (config.parentLocale != null) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
if (localeFamilies[name]) {
localeFamilies[name].forEach(function (x) {
defineLocale(x.name, x.config);
});
}
// backwards compat for now: also set the locale
// make sure we set the locale AFTER all child locales have been
// created, so we won't end up with the child locale set.
getSetGlobalLocale(name);
return locales[name];
} else {
// useful for testing
@@ -93,6 +130,33 @@ export function defineLocale (name, values) {
}
}
export function updateLocale(name, config) {
if (config != null) {
var locale, parentConfig = baseConfig;
// MERGE
if (locales[name] != null) {
parentConfig = locales[name]._config;
}
config = mergeConfigs(parentConfig, config);
locale = new Locale(config);
locale.parentLocale = locales[name];
locales[name] = locale;
// backwards compat for now: also set the locale
getSetGlobalLocale(name);
} else {
// pass null for config to unupdate, useful for tests
if (locales[name] != null) {
if (locales[name].parentLocale != null) {
locales[name] = locales[name].parentLocale;
} else if (locales[name] != null) {
delete locales[name];
}
}
}
return locales[name];
}
// returns locale data
export function getLocale (key) {
var locale;
@@ -116,3 +180,7 @@ export function getLocale (key) {
return chooseLocale(key);
}
export function listLocales() {
return keys(locales);
}

View File

@@ -2,26 +2,20 @@ 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 { calendar } from './calendar';
import { longDateFormat } from './formats';
import { invalidDate } from './invalid';
import { ordinal } from './ordinal';
import { preParsePostFormat } from './pre-post-format';
import { defaultRelativeTime, relativeTime, pastFuture } from './relative';
import { 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;
@@ -29,48 +23,47 @@ proto.set = set;
// Month
import {
localeMonthsParse,
defaultLocaleMonths, localeMonths,
defaultLocaleMonthsShort, localeMonthsShort,
defaultMonthsRegex, monthsRegex,
defaultMonthsShortRegex, monthsShortRegex
localeMonths,
localeMonthsShort,
monthsRegex,
monthsShortRegex
} from '../units/month';
proto.months = localeMonths;
proto._months = defaultLocaleMonths;
proto.monthsShort = localeMonthsShort;
proto._monthsShort = defaultLocaleMonthsShort;
proto.monthsParse = localeMonthsParse;
proto._monthsRegex = defaultMonthsRegex;
proto.monthsRegex = monthsRegex;
proto._monthsShortRegex = defaultMonthsShortRegex;
proto.monthsShortRegex = monthsShortRegex;
// Week
import { localeWeek, defaultLocaleWeek, localeFirstDayOfYear, localeFirstDayOfWeek } from '../units/week';
import { localeWeek, 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
localeWeekdays,
localeWeekdaysMin,
localeWeekdaysShort,
weekdaysRegex,
weekdaysShortRegex,
weekdaysMinRegex
} 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;
proto.weekdaysRegex = weekdaysRegex;
proto.weekdaysShortRegex = weekdaysShortRegex;
proto.weekdaysMinRegex = weekdaysMinRegex;
// Hours
import { localeIsPM, defaultLocaleMeridiemParse, localeMeridiem } from '../units/hour';
import { localeIsPM, localeMeridiem } from '../units/hour';
proto.isPM = localeIsPM;
proto._meridiemParse = defaultLocaleMeridiemParse;
proto.meridiem = localeMeridiem;

View File

@@ -1,4 +1,7 @@
import isFunction from '../utils/is-function';
import extend from '../utils/extend';
import isObject from '../utils/is-object';
import hasOwnProp from '../utils/has-own-prop';
export function set (config) {
var prop, i;
@@ -10,7 +13,34 @@ export function set (config) {
this['_' + i] = prop;
}
}
this._config = config;
// 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);
}
export function mergeConfigs(parentConfig, childConfig) {
var res = extend({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp(childConfig, prop)) {
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
res[prop] = {};
extend(res[prop], parentConfig[prop]);
extend(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp(parentConfig, prop) &&
!hasOwnProp(childConfig, prop) &&
isObject(parentConfig[prop])) {
// make sure changes to properties don't modify parent config
res[prop] = extend({}, res[prop]);
}
}
return res;
}

View File

@@ -3,6 +3,8 @@ import { setMonth } from '../units/month';
import { createDuration } from '../duration/create';
import { deprecateSimple } from '../utils/deprecate';
import { hooks } from '../utils/hooks';
import absRound from '../utils/abs-round';
// TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) {
@@ -10,7 +12,8 @@ function createAdder(direction, name) {
var dur, tmp;
//invert the arguments, but complain about it
if (period !== null && !isNaN(+period)) {
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
tmp = val; val = period; period = tmp;
}
@@ -23,8 +26,8 @@ function createAdder(direction, name) {
export function addSubtract (mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = duration._days,
months = duration._months;
days = absRound(duration._days),
months = absRound(duration._months);
if (!mom.isValid()) {
// No op
@@ -34,7 +37,7 @@ export function addSubtract (mom, duration, isAdding, updateOffset) {
updateOffset = updateOffset == null ? true : updateOffset;
if (milliseconds) {
mom._d.setTime(+mom._d + milliseconds * isAdding);
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
}
if (days) {
set(mom, 'Date', get(mom, 'Date') + days * isAdding);

View File

@@ -1,21 +1,26 @@
import { createLocal } from '../create/local';
import { cloneWithOffset } from '../units/offset';
import isFunction from '../utils/is-function';
import { hooks } from '../utils/hooks';
export function getCalendarFormat(myMoment, now) {
var diff = myMoment.diff(now, 'days', true);
return diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
}
export function calendar (time, formats) {
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're local/utc/offset or not.
var now = time || createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
diff = this.diff(sod, 'days', true),
format = diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
format = hooks.calendarFormat(this, sod) || 'sameElse';
var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]);
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
}

View File

@@ -10,9 +10,9 @@ export function isAfter (input, units) {
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return +this > +localInput;
return this.valueOf() > localInput.valueOf();
} else {
return +localInput < +this.clone().startOf(units);
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
@@ -23,14 +23,16 @@ export function isBefore (input, units) {
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return +this < +localInput;
return this.valueOf() < localInput.valueOf();
} else {
return +this.clone().endOf(units) < +localInput;
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
export function isBetween (from, to, units) {
return this.isAfter(from, units) && this.isBefore(to, units);
export function isBetween (from, to, units, inclusivity) {
inclusivity = inclusivity || '()';
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
}
export function isSame (input, units) {
@@ -41,10 +43,10 @@ export function isSame (input, units) {
}
units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') {
return +this === +localInput;
return this.valueOf() === localInput.valueOf();
} else {
inputMs = +localInput;
return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}

View File

@@ -60,6 +60,9 @@ var updateInProgress = false;
export function Moment(config) {
copyConfig(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = new Date(NaN);
}
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {

View File

@@ -57,5 +57,6 @@ function monthDiff (a, b) {
adjust = (b - anchor) / (anchor2 - anchor);
}
return -(wholeMonthDiff + adjust);
//check for negative zero, return zero if negative zero
return -(wholeMonthDiff + adjust) || 0;
}

View File

@@ -3,6 +3,7 @@ import { hooks } from '../utils/hooks';
import isFunction from '../utils/is-function';
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
export function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
@@ -22,7 +23,34 @@ export function toISOString () {
}
}
/**
* Return a human readable representation of a moment that can
* also be evaluated to get a new moment which is the same
*
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
*/
export function inspect () {
if (!this.isValid()) {
return 'moment.invalid(/* ' + this._i + ' */)';
}
var func = 'moment';
var zone = '';
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
zone = 'Z';
}
var prefix = '[' + func + '("]';
var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
var datetime = '-MM-DD[T]HH:mm:ss.SSS';
var suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
export function format (inputString) {
var output = formatMoment(this, inputString || hooks.defaultFormat);
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}

View File

@@ -1,7 +1,9 @@
import { normalizeUnits } from '../units/aliases';
import { normalizeUnits, normalizeObjectUnits } from '../units/aliases';
import { getPrioritizedUnits } from '../units/priorities';
import { hooks } from '../utils/hooks';
import isFunction from '../utils/is-function';
export function makeGetSet (unit, keepTime) {
return function (value) {
if (value != null) {
@@ -27,11 +29,21 @@ export function set (mom, unit, value) {
// MOMENTS
export function getSet (units, value) {
var unit;
export function stringGet (units) {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units]();
}
return this;
}
export function stringSet (units, value) {
if (typeof units === 'object') {
for (unit in units) {
this.set(unit, units[unit]);
units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units);
for (var i = 0; i < prioritized.length; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits(units);

View File

@@ -4,19 +4,19 @@ import { createLocal } from '../create/local';
import { createInvalid } from '../create/valid';
export var prototypeMin = deprecate(
'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}
);
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}
);
export var prototypeMax = deprecate(
'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {

View File

@@ -3,14 +3,14 @@ import { Moment } from './constructor';
var proto = Moment.prototype;
import { add, subtract } from './add-subtract';
import { calendar } from './calendar';
import { calendar, getCalendarFormat } from './calendar';
import { clone } from './clone';
import { isBefore, isBetween, isSame, isAfter, isSameOrAfter, isSameOrBefore } from './compare';
import { diff } from './diff';
import { format, toString, toISOString } from './format';
import { format, toString, toISOString, inspect } from './format';
import { from, fromNow } from './from';
import { to, toNow } from './to';
import { getSet } from './get-set';
import { stringGet, stringSet } from './get-set';
import { locale, localeData, lang } from './locale';
import { prototypeMin, prototypeMax } from './min-max';
import { startOf, endOf } from './start-end-of';
@@ -28,7 +28,7 @@ proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = getSet;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter;
proto.isBefore = isBefore;
@@ -43,13 +43,14 @@ proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = getSet;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract;
proto.toArray = toArray;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
proto.toJSON = toJSON;
proto.toString = toString;
proto.unix = unix;
@@ -128,7 +129,6 @@ proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isDSTShifted = isDaylightSavingTimeShifted;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
@@ -144,6 +144,7 @@ import { deprecate } from '../utils/deprecate';
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
export default proto;

View File

@@ -5,26 +5,27 @@ export function startOf (units) {
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
@@ -48,5 +49,11 @@ export function endOf (units) {
if (units === undefined || units === 'millisecond') {
return this;
}
// 'date' is an alias for 'day', so it should be considered as such.
if (units === 'date') {
units = 'day';
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}

View File

@@ -1,13 +1,13 @@
export function valueOf () {
return +this._d - ((this._offset || 0) * 60000);
return this._d.valueOf() - ((this._offset || 0) * 60000);
}
export function unix () {
return Math.floor(+this / 1000);
return Math.floor(this.valueOf() / 1000);
}
export function toDate () {
return this._offset ? new Date(+this) : this._d;
return new Date(this.valueOf());
}
export function toArray () {
@@ -29,6 +29,6 @@ export function toObject () {
}
export function toJSON () {
// JSON.stringify(new Date(NaN)) === 'null'
return this.isValid() ? this.toISOString() : 'null';
// new Date(NaN).toJSON() === null
return this.isValid() ? this.toISOString() : null;
}

View File

@@ -1,4 +1,5 @@
import hasOwnProp from '../utils/has-own-prop';
import isNumber from '../utils/is-number';
import toInt from '../utils/to-int';
var tokens = {};
@@ -8,7 +9,7 @@ export function addParseToken (token, callback) {
if (typeof token === 'string') {
token = [token];
}
if (typeof callback === 'number') {
if (isNumber(callback)) {
func = function (input, array) {
array[callback] = toInt(input);
};

View File

@@ -27,3 +27,4 @@ export function normalizeObjectUnits(inputObject) {
return normalizedInput;
}

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { DATE } from './constants';
@@ -14,6 +15,9 @@ addFormatToken('D', ['DD', 2], 'Do', 'date');
addUnitAlias('date', 'D');
// PRIOROITY
addUnitPriority('date', 9);
// PARSING
addRegexToken('D', match1to2);

View File

@@ -1,10 +1,13 @@
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addRegexToken, match1to2, matchWord } from '../parse/regex';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, matchWord, regexEscape } from '../parse/regex';
import { addWeekParseToken } from '../parse/token';
import toInt from '../utils/to-int';
import isArray from '../utils/is-array';
import { createLocal } from '../create/local';
import indexOf from '../utils/index-of';
import hasOwnProp from '../utils/has-own-prop';
import { createUTC } from '../create/utc';
import getParsingFlags from '../create/parsing-flags';
// FORMATTING
@@ -32,14 +35,25 @@ addUnitAlias('day', 'd');
addUnitAlias('weekday', 'e');
addUnitAlias('isoWeekday', 'E');
// PRIORITY
addUnitPriority('day', 11);
addUnitPriority('weekday', 11);
addUnitPriority('isoWeekday', 11);
// PARSING
addRegexToken('d', match1to2);
addRegexToken('e', match1to2);
addRegexToken('E', match1to2);
addRegexToken('dd', matchWord);
addRegexToken('ddd', matchWord);
addRegexToken('dddd', matchWord);
addRegexToken('dd', function (isStrict, locale) {
return locale.weekdaysMinRegex(isStrict);
});
addRegexToken('ddd', function (isStrict, locale) {
return locale.weekdaysShortRegex(isStrict);
});
addRegexToken('dddd', function (isStrict, locale) {
return locale.weekdaysRegex(isStrict);
});
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
var weekday = config._locale.weekdaysParse(input, token, config._strict);
@@ -74,27 +88,105 @@ function parseWeekday(input, locale) {
return null;
}
function parseIsoWeekday(input, locale) {
if (typeof input === 'string') {
return locale.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
// LOCALES
export var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
export function localeWeekdays (m, format) {
if (!m) {
return this._weekdays;
}
return isArray(this._weekdays) ? this._weekdays[m.day()] :
this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
}
export var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
export function localeWeekdaysShort (m) {
return this._weekdaysShort[m.day()];
return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
export var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
export function localeWeekdaysMin (m) {
return this._weekdaysMin[m.day()];
return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse(weekdayName, format, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC([2000, 1]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
export function localeWeekdaysParse (weekdayName, format, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse.call(this, weekdayName, format, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
@@ -105,7 +197,7 @@ export function localeWeekdaysParse (weekdayName, format, strict) {
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createLocal([2000, 1]).day(i);
mom = createUTC([2000, 1]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
@@ -155,8 +247,117 @@ export function getSetISODayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
if (input != null) {
var weekday = parseIsoWeekday(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
var defaultWeekdaysRegex = matchWord;
export function weekdaysRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysRegex')) {
this._weekdaysRegex = defaultWeekdaysRegex;
}
return this._weekdaysStrictRegex && isStrict ?
this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
var defaultWeekdaysShortRegex = matchWord;
export function weekdaysShortRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysShortRegex')) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
}
return this._weekdaysShortStrictRegex && isStrict ?
this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
var defaultWeekdaysMinRegex = matchWord;
export function weekdaysMinRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysMinRegex')) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
}
return this._weekdaysMinStrictRegex && isStrict ?
this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
minp = this.weekdaysMin(mom, '');
shortp = this.weekdaysShort(mom, '');
longp = this.weekdays(mom, '');
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
// Sorting makes sure if one weekday (or abbr) is a prefix of another it
// will match the longer piece.
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 7; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
}

View File

@@ -1,5 +1,6 @@
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match3, match1to3 } from '../parse/regex';
import { daysInYear } from './year';
import { createUTCDate } from '../create/date-from-array';
@@ -14,6 +15,9 @@ addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
addUnitAlias('dayOfYear', 'DDD');
// PRIORITY
addUnitPriority('dayOfYear', 4);
// PARSING
addRegexToken('DDD', match1to3);

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2, match3to4, match5to6 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { HOUR, MINUTE, SECOND } from './constants';
@@ -14,8 +15,13 @@ function hFormat() {
return this.hours() % 12 || 12;
}
function kFormat() {
return this.hours() || 24;
}
addFormatToken('H', ['HH', 2], 0, 'hour');
addFormatToken('h', ['hh', 2], 0, hFormat);
addFormatToken('k', ['kk', 2], 0, kFormat);
addFormatToken('hmm', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
@@ -48,6 +54,9 @@ meridiem('A', false);
addUnitAlias('hour', 'h');
// PRIORITY
addUnitPriority('hour', 13);
// PARSING
function matchMeridiem (isStrict, locale) {

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1, match2, match3, match1to3, matchUnsigned } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { MILLISECOND } from './constants';
@@ -41,6 +42,10 @@ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
addUnitAlias('millisecond', 'ms');
// PRIORITY
addUnitPriority('millisecond', 16);
// PARSING
addRegexToken('S', match1to3, match1);

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { MINUTE } from './constants';
@@ -13,6 +14,10 @@ addFormatToken('m', ['mm', 2], 0, 'minute');
addUnitAlias('minute', 'm');
// PRIORITY
addUnitPriority('minute', 14);
// PARSING
addRegexToken('m', match1to2);

View File

@@ -2,12 +2,15 @@ import { get } from '../moment/get-set';
import hasOwnProp from '../utils/has-own-prop';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2, matchWord, regexEscape } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { hooks } from '../utils/hooks';
import { MONTH } from './constants';
import toInt from '../utils/to-int';
import isArray from '../utils/is-array';
import isNumber from '../utils/is-number';
import indexOf from '../utils/index-of';
import { createUTC } from '../create/utc';
import getParsingFlags from '../create/parsing-flags';
@@ -33,6 +36,10 @@ addFormatToken('MMMM', 0, 0, function (format) {
addUnitAlias('month', 'M');
// PRIORITY
addUnitPriority('month', 8);
// PARSING
addRegexToken('M', match1to2);
@@ -60,28 +67,82 @@ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
// LOCALES
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/;
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
export var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
export function localeMonths (m, format) {
if (!m) {
return this._months;
}
return isArray(this._months) ? this._months[m.month()] :
this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
}
export var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
export function localeMonthsShort (m, format) {
if (!m) {
return this._monthsShort;
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
}
function handleStrictParse(monthName, format, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
// this is not used
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC([2000, i]);
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
export function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse.call(this, monthName, format, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
// TODO: add sorting
// Sorting makes sure if one month (or abbr) is a prefix of another
// see sorting in computeMonthsParse
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
@@ -114,12 +175,15 @@ export function setMonth (mom, value) {
return mom;
}
// TODO: Move this out of here!
if (typeof value === 'string') {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (typeof value !== 'number') {
return mom;
if (/^\d+$/.test(value)) {
value = toInt(value);
} else {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (!isNumber(value)) {
return mom;
}
}
}
@@ -142,7 +206,7 @@ export function getDaysInMonth () {
return daysInMonth(this.year(), this.month());
}
export var defaultMonthsShortRegex = matchWord;
var defaultMonthsShortRegex = matchWord;
export function monthsShortRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
@@ -154,12 +218,15 @@ export function monthsShortRegex (isStrict) {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp(this, '_monthsShortRegex')) {
this._monthsShortRegex = defaultMonthsShortRegex;
}
return this._monthsShortStrictRegex && isStrict ?
this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
export var defaultMonthsRegex = matchWord;
var defaultMonthsRegex = matchWord;
export function monthsRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
@@ -171,6 +238,9 @@ export function monthsRegex (isStrict) {
return this._monthsRegex;
}
} else {
if (!hasOwnProp(this, '_monthsRegex')) {
this._monthsRegex = defaultMonthsRegex;
}
return this._monthsStrictRegex && isStrict ?
this._monthsStrictRegex : this._monthsRegex;
}
@@ -199,11 +269,13 @@ function computeMonthsParse () {
for (i = 0; i < 12; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
}
for (i = 0; i < 24; i++) {
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')$', 'i');
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')$', 'i');
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
}

View File

@@ -48,12 +48,19 @@ addParseToken(['Z', 'ZZ'], function (input, array, config) {
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var matches = ((string || '').match(matcher) || []);
var matches = (string || '').match(matcher);
if (matches === null) {
return null;
}
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return parts[0] === '+' ? minutes : -minutes;
return minutes === 0 ?
0 :
parts[0] === '+' ? minutes : -minutes;
}
// Return a moment from input, that is local/utc/zone equivalent to model.
@@ -61,9 +68,9 @@ export function cloneWithOffset(input, model) {
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (isMoment(input) || isDate(input) ? +input : +createLocal(input)) - (+res);
diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
// Use low-level api, because this fn is low-level api.
res._d.setTime(+res._d + diff);
res._d.setTime(res._d.valueOf() + diff);
hooks.updateOffset(res, false);
return res;
} else {
@@ -104,6 +111,9 @@ export function getSetOffset (input, keepLocalTime) {
if (input != null) {
if (typeof input === 'string') {
input = offsetFromString(matchShortOffset, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16) {
input = input * 60;
}
@@ -161,10 +171,16 @@ export function setOffsetToLocal (keepLocalTime) {
}
export function setOffsetToParsedOffset () {
if (this._tzm) {
if (this._tzm != null) {
this.utcOffset(this._tzm);
} else if (typeof this._i === 'string') {
this.utcOffset(offsetFromString(matchOffset, this._i));
var tZone = offsetFromString(matchOffset, this._i);
if (tZone != null) {
this.utcOffset(tZone);
}
else {
this.utcOffset(0, true);
}
}
return this;
}

View File

@@ -0,0 +1,16 @@
var priorities = {};
export function addUnitPriority(unit, priority) {
priorities[unit] = priority;
}
export function getPrioritizedUnits(unitsObj) {
var units = [];
for (var u in unitsObj) {
units.push({unit: u, priority: priorities[u]});
}
units.sort(function (a, b) {
return a.priority - b.priority;
});
return units;
}

View File

@@ -1,5 +1,6 @@
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { MONTH } from './constants';
@@ -13,6 +14,10 @@ addFormatToken('Q', 0, 'Qo', 'quarter');
addUnitAlias('quarter', 'Q');
// PRIORITY
addUnitPriority('quarter', 7);
// PARSING
addRegexToken('Q', match1);

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { SECOND } from './constants';
@@ -13,6 +14,10 @@ addFormatToken('s', ['ss', 2], 0, 'second');
addUnitAlias('second', 's');
// PRIORITY
addUnitPriority('second', 15);
// PARSING
addRegexToken('s', match1to2);

View File

@@ -1,5 +1,6 @@
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex';
import { addWeekParseToken } from '../parse/token';
import { weekOfYear, weeksInYear, dayOfYearFromWeeks } from './week-calendar-utils';
@@ -32,6 +33,12 @@ addWeekYearFormatToken('GGGGG', 'isoWeekYear');
addUnitAlias('weekYear', 'gg');
addUnitAlias('isoWeekYear', 'GG');
// PRIORITY
addUnitPriority('weekYear', 1);
addUnitPriority('isoWeekYear', 1);
// PARSING
addRegexToken('G', matchSigned);
@@ -93,7 +100,6 @@ function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
// console.log("got", weekYear, week, weekday, "set", date.toISOString());
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());

View File

@@ -1,5 +1,6 @@
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match2 } from '../parse/regex';
import { addWeekParseToken } from '../parse/token';
import toInt from '../utils/to-int';
@@ -16,6 +17,11 @@ addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
addUnitAlias('week', 'w');
addUnitAlias('isoWeek', 'W');
// PRIORITIES
addUnitPriority('week', 5);
addUnitPriority('isoWeek', 5);
// PARSING
addRegexToken('w', match1to2);

View File

@@ -1,6 +1,7 @@
import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { hooks } from '../utils/hooks';
@@ -26,6 +27,10 @@ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
addUnitAlias('year', 'y');
// PRIORITIES
addUnitPriority('year', 1);
// PARSING
addRegexToken('Y', matchSigned);
@@ -63,7 +68,7 @@ hooks.parseTwoDigitYear = function (input) {
// MOMENTS
export var getSetYear = makeGetSet('FullYear', false);
export var getSetYear = makeGetSet('FullYear', true);
export function getIsLeapYear () {
return isLeapYear(this.year());

View File

@@ -1,6 +1,7 @@
export default function absFloor (number) {
if (number < 0) {
return Math.ceil(number);
// -0 -> 0
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}

View File

@@ -0,0 +1,7 @@
export default function absRound (number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}

View File

@@ -13,8 +13,26 @@ export function deprecate(msg, fn) {
var firstTime = true;
return extend(function () {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack);
var args = [];
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = '';
if (typeof arguments[i] === 'object') {
arg += '\n[' + i + '] ';
for (var key in arguments[0]) {
arg += key + ': ' + arguments[0][key] + ', ';
}
arg = arg.slice(0, -2); // Remove trailing comma and space
} else {
arg = arguments[i];
}
args.push(arg);
}
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
firstTime = false;
}
return fn.apply(this, arguments);
@@ -24,6 +42,9 @@ export function deprecate(msg, fn) {
var deprecations = {};
export function deprecateSimple(name, msg) {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
@@ -31,3 +52,4 @@ export function deprecateSimple(name, msg) {
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;

View File

@@ -0,0 +1,18 @@
var indexOf;
if (Array.prototype.indexOf) {
indexOf = Array.prototype.indexOf;
} else {
indexOf = function (o) {
// I know
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
export { indexOf as default };

View File

@@ -1,3 +1,3 @@
export default function isArray(input) {
return Object.prototype.toString.call(input) === '[object Array]';
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
}

View File

@@ -0,0 +1,3 @@
export default function isNumber(input) {
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
}

View File

@@ -0,0 +1,8 @@
export default function isObjectEmpty(obj) {
var k;
for (k in obj) {
// even if its not own property I'd still call it non-empty
return false;
}
return true;
}

View File

@@ -0,0 +1,5 @@
export default function isObject(input) {
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return input != null && Object.prototype.toString.call(input) === '[object Object]';
}

View File

@@ -0,0 +1,19 @@
import hasOwnProp from './has-own-prop';
var keys;
if (Object.keys) {
keys = Object.keys;
} else {
keys = function (obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp(obj, i)) {
res.push(i);
}
}
return res;
};
}
export { keys as default };

View File

@@ -0,0 +1,19 @@
var some;
if (Array.prototype.some) {
some = Array.prototype.some;
} else {
some = function (fun) {
var t = Object(this);
var len = t.length >>> 0;
for (var i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
export { some as default };

View File

@@ -1,12 +1,12 @@
//! moment.js locale configuration
//! locale : afrikaans (af)
//! locale : Afrikaans [af]
//! author : Werner Mollentze : https://github.com/wernerm
import moment from '../moment';
export default moment.defineLocale('af', {
months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
monthsShort : 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'),
weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),

View File

@@ -0,0 +1,50 @@
//! moment.js locale configuration
//! locale : Arabic (Algeria) [ar-dz]
//! author : Noureddine LOUAHEDJ : https://github.com/noureddineme
import moment from '../moment';
export default moment.defineLocale('ar-dz', {
months : انفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
monthsShort : انفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
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 : 0, // Sunday is the first day of the week.
doy : 4 // The week that contains Jan 1st is the first week of the year.
}
});

View File

@@ -0,0 +1,112 @@
//! moment.js locale configuration
//! locale : Arabic (Lybia) [ar-ly]
//! author : Ali Hmer: https://github.com/kikoanis
import moment from '../moment';
var symbolMap = {
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'0': '0'
}, pluralForm = function (n) {
return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
}, plurals = {
s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
}, pluralize = function (u) {
return function (number, withoutSuffix, string, isFuture) {
var f = pluralForm(number),
str = plurals[u][pluralForm(number)];
if (f === 2) {
str = str[withoutSuffix ? 0 : 1];
}
return str.replace(/%d/i, number);
};
}, months = [
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر'
];
export default moment.defineLocale('ar-ly', {
months : months,
monthsShort : months,
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'D/\u200FM/\u200FYYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /ص|م/,
isPM : function (input) {
return 'م' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ص';
} else {
return 'م';
}
},
calendar : {
sameDay: '[اليوم عند الساعة] LT',
nextDay: '[غدًا عند الساعة] LT',
nextWeek: 'dddd [عند الساعة] LT',
lastDay: '[أمس عند الساعة] LT',
lastWeek: 'dddd [عند الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'بعد %s',
past : 'منذ %s',
s : pluralize('s'),
m : pluralize('m'),
mm : pluralize('m'),
h : pluralize('h'),
hh : pluralize('h'),
d : pluralize('d'),
dd : pluralize('d'),
M : pluralize('M'),
MM : pluralize('M'),
y : pluralize('y'),
yy : pluralize('y')
},
preparse: function (string) {
return string.replace(/\u200f/g, '').replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
}).replace(/,/g, '،');
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Moroccan Arabic (ar-ma)
//! locale : Arabic (Morocco) [ar-ma]
//! author : ElFadili Yassine : https://github.com/ElFadiliY
//! author : Abdel Said : https://github.com/abdelsaid
@@ -11,6 +11,7 @@ export default moment.defineLocale('ar-ma', {
weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Arabic Saudi Arabia (ar-sa)
//! locale : Arabic (Saudi Arabia) [ar-sa]
//! author : Suhail Alkowaileet : https://github.com/xsoh
import moment from '../moment';
@@ -34,6 +34,7 @@ export default moment.defineLocale('ar-sa', {
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
@@ -87,8 +88,8 @@ export default moment.defineLocale('ar-sa', {
}).replace(/,/g, '،');
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});

View File

@@ -1,5 +1,6 @@
//! moment.js locale configuration
//! locale : Tunisian Arabic (ar-tn)
//! locale : Arabic (Tunisia) [ar-tn]
//! author : Nader Toukabri : https://github.com/naderio
import moment from '../moment';
@@ -9,6 +10,7 @@ export default moment.defineLocale('ar-tn', {
weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',

View File

@@ -1,8 +1,8 @@
//! moment.js locale configuration
//! Locale: Arabic (ar)
//! Author: Abdel Said: https://github.com/abdelsaid
//! Changes in months, weekdays: Ahmed Elkhatib
//! Native plural forms: forabi https://github.com/forabi
//! locale : Arabic [ar]
//! author : Abdel Said: https://github.com/abdelsaid
//! author : Ahmed Elkhatib
//! author : forabi https://github.com/forabi
import moment from '../moment';
@@ -67,6 +67,7 @@ export default moment.defineLocale('ar', {
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : azerbaijani (az)
//! locale : Azerbaijani [az]
//! author : topchiyev : https://github.com/topchiyev
import moment from '../moment';
@@ -31,6 +31,7 @@ export default moment.defineLocale('az', {
weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'),
weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : belarusian (be)
//! locale : Belarusian [be]
//! author : Dmitry Demidov : https://github.com/demidov91
//! author: Praleska: http://praleska.pro/
//! Author : Menelion Elensúle : https://github.com/Oire
@@ -59,15 +59,15 @@ export default moment.defineLocale('be', {
},
lastWeek: function () {
switch (this.day()) {
case 0:
case 3:
case 5:
case 6:
return '[У мінулую] dddd [ў] LT';
case 1:
case 2:
case 4:
return '[У мінулы] dddd [ў] LT';
case 0:
case 3:
case 5:
case 6:
return '[У мінулую] dddd [ў] LT';
case 1:
case 2:
case 4:
return '[У мінулы] dddd [ў] LT';
}
},
sameElse: 'L'
@@ -105,16 +105,16 @@ export default moment.defineLocale('be', {
ordinalParse: /\d{1,2}-(і|ы|га)/,
ordinal: function (number, period) {
switch (period) {
case 'M':
case 'd':
case 'DDD':
case 'w':
case 'W':
return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы';
case 'D':
return number + '-га';
default:
return number;
case 'M':
case 'd':
case 'DDD':
case 'w':
case 'W':
return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы';
case 'D':
return number + '-га';
default:
return number;
}
},
week : {

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : bulgarian (bg)
//! locale : Bulgarian [bg]
//! author : Krasen Borisov : https://github.com/kraz
import moment from '../moment';
@@ -25,15 +25,15 @@ export default moment.defineLocale('bg', {
lastDay : '[Вчера в] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
case 3:
case 6:
return '[В изминалата] dddd [в] LT';
case 1:
case 2:
case 4:
case 5:
return '[В изминалия] dddd [в] LT';
case 0:
case 3:
case 6:
return '[В изминалата] dddd [в] LT';
case 1:
case 2:
case 4:
case 5:
return '[В изминалия] dddd [в] LT';
}
},
sameElse : 'L'

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Bengali (bn)
//! locale : Bengali [bn]
//! author : Kaushik Gandhi : https://github.com/kaushikgandhi
import moment from '../moment';
@@ -30,11 +30,11 @@ numberMap = {
};
export default moment.defineLocale('bn', {
months : 'জানুয়ারী_ফেবুয়ার_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_গ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'),
weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'),
weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'),
weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'),
months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_গ_সেপ্ট_অক্টো_নভ_ডিসে'.split('_'),
weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'),
weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
weekdaysMin : 'রবি_সম_মঙ্গ_বু_বৃহঃ_শুক্র_শনি'.split('_'),
longDateFormat : {
LT : 'A h:mm সময়',
LTS : 'A h:mm:ss সময়',
@@ -77,12 +77,18 @@ export default moment.defineLocale('bn', {
});
},
meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
isPM: function (input) {
return /^(দুপুর|বিকাল|রাত)$/.test(input);
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if ((meridiem === 'রাত' && hour >= 4) ||
(meridiem === 'দুপুর' && hour < 5) ||
meridiem === 'বিকাল') {
return hour + 12;
} else {
return hour;
}
},
//Bengali is a vast language its spoken
//in different forms in various parts of the world.
//I have just generalized with most common one used
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'রাত';
@@ -101,4 +107,3 @@ export default moment.defineLocale('bn', {
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : tibetan (bo)
//! locale : Tibetan [bo]
//! author : Thupten N. Chakrishar : https://github.com/vajradog
import moment from '../moment';
@@ -77,8 +77,17 @@ export default moment.defineLocale('bo', {
});
},
meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
isPM: function (input) {
return /^(ཉིན་གུང|དགོང་དག|མཚན་མོ)$/.test(input);
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if ((meridiem === 'མཚན་མོ' && hour >= 4) ||
(meridiem === 'ཉིན་གུང' && hour < 5) ||
meridiem === 'དགོང་དག') {
return hour + 12;
} else {
return hour;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : breton (br)
//! locale : Breton [br]
//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou
import moment from '../moment';
@@ -14,14 +14,14 @@ function relativeTimeWithMutation(number, withoutSuffix, key) {
}
function specialMutationForYears(number) {
switch (lastNumber(number)) {
case 1:
case 3:
case 4:
case 5:
case 9:
return number + ' bloaz';
default:
return number + ' vloaz';
case 1:
case 3:
case 4:
case 5:
case 9:
return number + ' bloaz';
default:
return number + ' vloaz';
}
}
function lastNumber(number) {
@@ -54,6 +54,7 @@ export default moment.defineLocale('br', {
weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h[e]mm A',
LTS : 'h[e]mm:ss A',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : bosnian (bs)
//! locale : Bosnian [bs]
//! author : Nedim Cholich : https://github.com/frontyard
//! based on (hr) translation by Bojan Marković
@@ -8,66 +8,68 @@ import moment from '../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 += 'mjesec';
} else if (number === 2 || number === 3 || number === 4) {
result += 'mjeseca';
} else {
result += 'mjeseci';
}
return result;
case 'yy':
if (number === 1) {
result += 'godina';
} else if (number === 2 || number === 3 || number === 4) {
result += 'godine';
} else {
result += 'godina';
}
return result;
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 += 'mjesec';
} else if (number === 2 || number === 3 || number === 4) {
result += 'mjeseca';
} else {
result += 'mjeseci';
}
return result;
case 'yy':
if (number === 1) {
result += 'godina';
} else if (number === 2 || number === 3 || number === 4) {
result += 'godine';
} else {
result += 'godina';
}
return result;
}
}
export default moment.defineLocale('bs', {
months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'),
monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD. MM. YYYY',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd, D. MMMM YYYY H:mm'
@@ -77,32 +79,32 @@ export default moment.defineLocale('bs', {
nextDay : '[sutra u] LT',
nextWeek : function () {
switch (this.day()) {
case 0:
return '[u] [nedjelju] [u] LT';
case 3:
return '[u] [srijedu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
case 0:
return '[u] [nedjelju] [u] LT';
case 3:
return '[u] [srijedu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
}
},
lastDay : '[jučer 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';
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'
@@ -129,4 +131,3 @@ export default moment.defineLocale('bs', {
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : catalan (ca)
//! locale : Catalan [ca]
//! author : Juan G. Hurtado : https://github.com/juanghurtado
import moment from '../moment';
@@ -7,9 +7,11 @@ import moment from '../moment';
export default moment.defineLocale('ca', {
months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'),
monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'),
monthsParseExact : true,
weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'),
weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
@@ -37,7 +39,7 @@ export default moment.defineLocale('ca', {
sameElse : 'L'
},
relativeTime : {
future : 'en %s',
future : 'd\'aquí %s',
past : 'fa %s',
s : 'uns segons',
m : 'un minut',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : czech (cs)
//! locale : Czech [cs]
//! author : petrbela : https://github.com/petrbela
import moment from '../moment';
@@ -12,53 +12,53 @@ function plural(n) {
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
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
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'minuty' : 'minut');
} else {
return result + 'minutami';
}
break;
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'hodiny' : 'hodin');
} else {
return result + 'hodinami';
}
break;
case 'd': // a day / in a day / a day ago
return (withoutSuffix || isFuture) ? 'den' : 'dnem';
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'dny' : 'dní');
} else {
return result + 'dny';
}
break;
case 'M': // a month / in a month / a month ago
return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'měsíce' : 'měsíců');
} else {
return result + 'měsíci';
}
break;
case 'y': // a year / in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'roky' : 'let');
} else {
return result + 'lety';
}
break;
case 's': // a few seconds / in a few seconds / a few seconds ago
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
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'minuty' : 'minut');
} else {
return result + 'minutami';
}
break;
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'hodiny' : 'hodin');
} else {
return result + 'hodinami';
}
break;
case 'd': // a day / in a day / a day ago
return (withoutSuffix || isFuture) ? 'den' : 'dnem';
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'dny' : 'dní');
} else {
return result + 'dny';
}
break;
case 'M': // a month / in a month / a month ago
return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'měsíce' : 'měsíců');
} else {
return result + 'měsíci';
}
break;
case 'y': // a year / in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'roky' : 'let');
} else {
return result + 'lety';
}
break;
}
}
@@ -96,43 +96,44 @@ export default moment.defineLocale('cs', {
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd D. MMMM YYYY H:mm'
LLLL : 'dddd D. MMMM YYYY H:mm',
l : 'D. M. YYYY'
},
calendar : {
sameDay: '[dnes v] LT',
nextDay: '[zítra v] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[v neděli v] LT';
case 1:
case 2:
return '[v] dddd [v] LT';
case 3:
return '[ve středu v] LT';
case 4:
return '[ve čtvrtek v] LT';
case 5:
return '[v pátek v] LT';
case 6:
return '[v sobotu v] LT';
case 0:
return '[v neděli v] LT';
case 1:
case 2:
return '[v] dddd [v] LT';
case 3:
return '[ve středu v] LT';
case 4:
return '[ve čtvrtek v] LT';
case 5:
return '[v pátek v] LT';
case 6:
return '[v sobotu v] LT';
}
},
lastDay: '[včera v] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[minulou neděli v] LT';
case 1:
case 2:
return '[minulé] dddd [v] LT';
case 3:
return '[minulou středu v] LT';
case 4:
case 5:
return '[minulý] dddd [v] LT';
case 6:
return '[minulou sobotu v] LT';
case 0:
return '[minulou neděli v] LT';
case 1:
case 2:
return '[minulé] dddd [v] LT';
case 3:
return '[minulou středu v] LT';
case 4:
case 5:
return '[minulý] dddd [v] LT';
case 6:
return '[minulou sobotu v] LT';
}
},
sameElse: 'L'

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : chuvash (cv)
//! locale : Chuvash [cv]
//! author : Anatoly Mironov : https://github.com/mirontoli
import moment from '../moment';

View File

@@ -1,6 +1,7 @@
//! moment.js locale configuration
//! locale : Welsh (cy)
//! author : Robert Allen
//! locale : Welsh [cy]
//! author : Robert Allen : https://github.com/robgallen
//! author : https://github.com/ryangreaves
import moment from '../moment';
@@ -10,6 +11,7 @@ export default moment.defineLocale('cy', {
weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'),
weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
weekdaysParseExact : true,
// time formats are the same as en-gb
longDateFormat: {
LT: 'HH:mm',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : danish (da)
//! locale : Danish [da]
//! author : Ulrik Nielsen : https://github.com/mrbase
import moment from '../moment';

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : austrian german (de-at)
//! locale : German (Austria) [de-at]
//! author : lluchs : https://github.com/lluchs
//! author: Menelion Elensúle: https://github.com/Oire
//! author : Martin Groller : https://github.com/MadMG
@@ -24,9 +24,11 @@ function processRelativeTime(number, withoutSuffix, key, isFuture) {
export default moment.defineLocale('de-at', {
months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT: 'HH:mm',
LTS: 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : german (de)
//! locale : German [de]
//! author : lluchs : https://github.com/lluchs
//! author: Menelion Elensúle: https://github.com/Oire
//! author : Mikolaj Dadela : https://github.com/mik01aj
@@ -23,9 +23,11 @@ function processRelativeTime(number, withoutSuffix, key, isFuture) {
export default moment.defineLocale('de', {
months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT: 'HH:mm',
LTS: 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : dhivehi (dv)
//! locale : Maldivian [dv]
//! author : Jawish Hameed : https://github.com/jawish
import moment from '../moment';
@@ -44,7 +44,7 @@ export default moment.defineLocale('dv', {
},
meridiemParse: /މކ|މފ/,
isPM : function (input) {
return '' === input;
return 'މފ' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : modern greek (el)
//! locale : Greek [el]
//! author : Aggelos Karalias : https://github.com/mehiel
import moment from '../moment';

View File

@@ -1,5 +1,6 @@
//! moment.js locale configuration
//! locale : australian english (en-au)
//! locale : English (Australia) [en-au]
//! author : Jared Morse : https://github.com/jarcoal
import moment from '../moment';

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : canadian english (en-ca)
//! locale : English (Canada) [en-ca]
//! author : Jonathan Abourbih : https://github.com/jonbca
import moment from '../moment';
@@ -14,9 +14,9 @@ export default moment.defineLocale('en-ca', {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'YYYY-MM-DD',
LL : 'D MMMM, YYYY',
LLL : 'D MMMM, YYYY h:mm A',
LLLL : 'dddd, D MMMM, YYYY h:mm A'
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY h:mm A',
LLLL : 'dddd, MMMM D, YYYY h:mm A'
},
calendar : {
sameDay : '[Today at] LT',
@@ -51,4 +51,3 @@ export default moment.defineLocale('en-ca', {
return number + output;
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : great britain english (en-gb)
//! locale : English (United Kingdom) [en-gb]
//! author : Chris Gedrim : https://github.com/chrisgedrim
import moment from '../moment';

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Irish english (en-ie)
//! locale : English (Ireland) [en-ie]
//! author : Chris Cartlidge : https://github.com/chriscartlidge
import moment from '../moment';

View File

@@ -1,5 +1,6 @@
//! moment.js locale configuration
//! locale : New Zealand english (en-nz)
//! locale : English (New Zealand) [en-nz]
//! author : Luke McGregor : https://github.com/lukemcgregor
import moment from '../moment';

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : esperanto (eo)
//! locale : Esperanto [eo]
//! author : Colin Dean : https://github.com/colindean
//! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko.
//! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni!

View File

@@ -0,0 +1,71 @@
//! moment.js locale configuration
//! locale : Spanish (Dominican Republic) [es-do]
import moment from '../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('_');
export default moment.defineLocale('es-do', {
months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
monthsShort : function (m, format) {
if (/-MMM-/.test(format)) {
return monthsShort[m.month()];
} else {
return monthsShortDot[m.month()];
}
},
monthsParseExact : true,
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('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY h:mm A',
LLLL : 'dddd, D [de] MMMM [de] YYYY h:mm A'
},
calendar : {
sameDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextDay : function () {
return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextWeek : function () {
return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastDay : function () {
return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : function () {
return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : 'en %s',
past : 'hace %s',
s : 'unos segundos',
m : 'un minuto',
mm : '%d minutos',
h : 'una hora',
hh : '%d horas',
d : 'un día',
dd : '%d días',
M : 'un mes',
MM : '%d meses',
y : 'un año',
yy : '%d años'
},
ordinalParse : /\d{1,2}º/,
ordinal : '%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.
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : spanish (es)
//! locale : Spanish [es]
//! author : Julio Napurí : https://github.com/julionc
import moment from '../moment';
@@ -16,9 +16,11 @@ export default moment.defineLocale('es', {
return monthsShortDot[m.month()];
}
},
monthsParseExact : true,
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('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : estonian (et)
//! locale : Estonian [et]
//! author : Henry Kehlmann : https://github.com/madhenry
//! improvements : Illimar Tambek : https://github.com/ragulka

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : euskara (eu)
//! locale : Basque [eu]
//! author : Eneko Illarramendi : https://github.com/eillarra
import moment from '../moment';
@@ -7,9 +7,11 @@ import moment from '../moment';
export default moment.defineLocale('eu', {
months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'),
monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'),
monthsParseExact : true,
weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'),
weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'),
weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Persian (fa)
//! locale : Persian [fa]
//! author : Ebrahim Byagowi : https://github.com/ebraminio
import moment from '../moment';
@@ -34,6 +34,7 @@ export default moment.defineLocale('fa', {
weekdays : 'یک\u200cشنبه_دوشنبهه\u200cشنبههارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
weekdaysShort : 'یک\u200cشنبه_دوشنبهه\u200cشنبههارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : finnish (fi)
//! locale : Finnish [fi]
//! author : Tarmo Aidantausta : https://github.com/bleadof
import moment from '../moment';
@@ -12,33 +12,33 @@ var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksa
function translate(number, withoutSuffix, key, isFuture) {
var result = '';
switch (key) {
case 's':
return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
case 'm':
return isFuture ? 'minuutin' : 'minuutti';
case 'mm':
result = isFuture ? 'minuutin' : 'minuuttia';
break;
case 'h':
return isFuture ? 'tunnin' : 'tunti';
case 'hh':
result = isFuture ? 'tunnin' : 'tuntia';
break;
case 'd':
return isFuture ? 'päivän' : 'päivä';
case 'dd':
result = isFuture ? 'päivän' : 'päivää';
break;
case 'M':
return isFuture ? 'kuukauden' : 'kuukausi';
case 'MM':
result = isFuture ? 'kuukauden' : 'kuukautta';
break;
case 'y':
return isFuture ? 'vuoden' : 'vuosi';
case 'yy':
result = isFuture ? 'vuoden' : 'vuotta';
break;
case 's':
return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
case 'm':
return isFuture ? 'minuutin' : 'minuutti';
case 'mm':
result = isFuture ? 'minuutin' : 'minuuttia';
break;
case 'h':
return isFuture ? 'tunnin' : 'tunti';
case 'hh':
result = isFuture ? 'tunnin' : 'tuntia';
break;
case 'd':
return isFuture ? 'päivän' : 'päivä';
case 'dd':
result = isFuture ? 'päivän' : 'päivää';
break;
case 'M':
return isFuture ? 'kuukauden' : 'kuukausi';
case 'MM':
result = isFuture ? 'kuukauden' : 'kuukautta';
break;
case 'y':
return isFuture ? 'vuoden' : 'vuosi';
case 'yy':
result = isFuture ? 'vuoden' : 'vuotta';
break;
}
result = verbalNumber(number, isFuture) + ' ' + result;
return result;

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : faroese (fo)
//! locale : Faroese [fo]
//! author : Ragnar Johannesen : https://github.com/ragnar123
import moment from '../moment';

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : canadian french (fr-ca)
//! locale : French (Canada) [fr-ca]
//! author : Jonathan Abourbih : https://github.com/jonbca
import moment from '../moment';
@@ -7,9 +7,11 @@ import moment from '../moment';
export default moment.defineLocale('fr-ca', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : swiss french (fr)
//! locale : French (Switzerland) [fr-ch]
//! author : Gaspard Bucher : https://github.com/gaspard
import moment from '../moment';
@@ -7,9 +7,11 @@ import moment from '../moment';
export default moment.defineLocale('fr-ch', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : french (fr)
//! locale : French [fr]
//! author : John Fischer : https://github.com/jfroffice
import moment from '../moment';
@@ -7,9 +7,11 @@ import moment from '../moment';
export default moment.defineLocale('fr', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : frisian (fy)
//! locale : Frisian [fy]
//! author : Robin van der Vliet : https://github.com/robin0van0der0v
import moment from '../moment';
@@ -16,9 +16,11 @@ export default moment.defineLocale('fy', {
return monthsShortWithDots[m.month()];
}
},
monthsParseExact : true,
weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'),
weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'),
weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : great britain scottish gealic (gd)
//! locale : Scottish Gaelic [gd]
//! author : Jon Ashdown : https://github.com/jonashdown
import moment from '../moment';

View File

@@ -1,22 +1,24 @@
//! moment.js locale configuration
//! locale : galician (gl)
//! locale : Galician [gl]
//! author : Juan G. Hurtado : https://github.com/juanghurtado
import moment from '../moment';
export default moment.defineLocale('gl', {
months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'),
monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'),
weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'),
weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'),
weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'),
months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'),
monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'),
weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'),
weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY H:mm',
LLLL : 'dddd D MMMM YYYY H:mm'
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY H:mm',
LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm'
},
calendar : {
sameDay : function () {
@@ -38,8 +40,8 @@ export default moment.defineLocale('gl', {
},
relativeTime : {
future : function (str) {
if (str === 'uns segundos') {
return 'nuns segundos';
if (str.indexOf('un') === 0) {
return 'n' + str;
}
return 'en ' + str;
},
@@ -60,7 +62,7 @@ export default moment.defineLocale('gl', {
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.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : Hebrew (he)
//! locale : Hebrew [he]
//! author : Tomer Cohen : https://github.com/tomer
//! author : Moshe Simantov : https://github.com/DevelopmentIL
//! author : Tal Ater : https://github.com/TalAter
@@ -68,6 +68,23 @@ export default moment.defineLocale('he', {
}
return number + ' שנים';
}
},
meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,
isPM : function (input) {
return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 5) {
return 'לפנות בוקר';
} else if (hour < 10) {
return 'בבוקר';
} else if (hour < 12) {
return isLower ? 'לפנה"צ' : 'לפני הצהריים';
} else if (hour < 18) {
return isLower ? 'אחה"צ' : 'אחרי הצהריים';
} else {
return 'בערב';
}
}
});

View File

@@ -1,5 +1,5 @@
//! moment.js locale configuration
//! locale : hindi (hi)
//! locale : Hindi [hi]
//! author : Mayank Singhal : https://github.com/mayanksinghal
import moment from '../moment';
@@ -32,6 +32,7 @@ numberMap = {
export default moment.defineLocale('hi', {
months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'),
monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
monthsParseExact: true,
weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),

Some files were not shown because too many files have changed in this diff Show More