// Month
import {
- localeMonthsParse,
+ // localeMonthsParse,
localeMonths,
localeMonthsShort,
- monthsRegex,
- monthsShortRegex
+ // monthsRegex,
+ // monthsShortRegex
} from '../units/month';
proto.months = localeMonths;
proto.monthsShort = localeMonthsShort;
-proto.monthsParse = localeMonthsParse;
-proto.monthsRegex = monthsRegex;
-proto.monthsShortRegex = monthsShortRegex;
+//proto.monthsParse = localeMonthsParse;
+// proto.monthsRegex = monthsRegex;
+// proto.monthsShortRegex = monthsShortRegex;
// Week
import { localeWeek, localeFirstDayOfYear, localeFirstDayOfWeek } from '../units/week';
// Day of Week
import {
- localeWeekdaysParse,
+ // localeWeekdaysParse,
localeWeekdays,
localeWeekdaysMin,
localeWeekdaysShort,
- weekdaysRegex,
- weekdaysShortRegex,
- weekdaysMinRegex
+ // weekdaysRegex,
+ // weekdaysShortRegex,
+ // weekdaysMinRegex
} from '../units/day-of-week';
proto.weekdays = localeWeekdays;
proto.weekdaysMin = localeWeekdaysMin;
proto.weekdaysShort = localeWeekdaysShort;
-proto.weekdaysParse = localeWeekdaysParse;
+//proto.weekdaysParse = localeWeekdaysParse;
-proto.weekdaysRegex = weekdaysRegex;
-proto.weekdaysShortRegex = weekdaysShortRegex;
-proto.weekdaysMinRegex = weekdaysMinRegex;
+// proto.weekdaysRegex = weekdaysRegex;
+// proto.weekdaysShortRegex = weekdaysShortRegex;
+// proto.weekdaysMinRegex = weekdaysMinRegex;
// Hours
import { localeIsPM, localeMeridiem } from '../units/hour';
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 { addRegexToken, match1to2, match2 } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { DATE } from './constants';
import toInt from '../utils/to-int';
// PARSING
-addRegexToken('D', match1to2);
-addRegexToken('DD', match1to2, match2);
-addRegexToken('Do', function (isStrict, locale) {
- return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
-});
+// addRegexToken('D', match1to2);
+// addRegexToken('DD', match1to2, match2);
+// addRegexToken('Do', function (isStrict, locale) {
+// return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
+// });
-addParseToken(['D', 'DD'], DATE);
-addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0], 10);
-});
+// addParseToken(['D', 'DD'], DATE);
+// addParseToken('Do', function (input, array) {
+// array[DATE] = toInt(input.match(match1to2)[0], 10);
+// });
// MOMENTS
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
-import { addRegexToken, match1to2, matchWord, regexEscape } from '../parse/regex';
-import { addWeekParseToken } from '../parse/token';
+// 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 indexOf from '../utils/index-of';
// PARSING
-addRegexToken('d', match1to2);
-addRegexToken('e', match1to2);
-addRegexToken('E', match1to2);
-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);
- // if we didn't get a weekday name, mark the date as invalid
- if (weekday != null) {
- week.d = weekday;
- } else {
- getParsingFlags(config).invalidWeekday = input;
- }
-});
-
-addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
- week[token] = toInt(input);
-});
+// addRegexToken('d', match1to2);
+// addRegexToken('e', match1to2);
+// addRegexToken('E', match1to2);
+// 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);
+// // if we didn't get a weekday name, mark the date as invalid
+// if (weekday != null) {
+// week.d = weekday;
+// } else {
+// getParsingFlags(config).invalidWeekday = input;
+// }
+// });
+
+// addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
+// week[token] = toInt(input);
+// });
// HELPERS
-function parseWeekday(input, locale) {
- if (typeof input !== 'string') {
- return input;
- }
+// function parseWeekday(input, locale) {
+// if (typeof input !== 'string') {
+// return input;
+// }
- if (!isNaN(input)) {
- return parseInt(input, 10);
- }
+// if (!isNaN(input)) {
+// return parseInt(input, 10);
+// }
- input = locale.weekdaysParse(input);
- if (typeof input === 'number') {
- return input;
- }
+// input = locale.weekdaysParse(input);
+// if (typeof input === 'number') {
+// return input;
+// }
- return null;
-}
+// return null;
+// }
-function parseIsoWeekday(input, locale) {
- if (typeof input === 'string') {
- return locale.weekdaysParse(input) % 7 || 7;
- }
- return isNaN(input) ? null : input;
-}
+// function parseIsoWeekday(input, locale) {
+// if (typeof input === 'string') {
+// return locale.weekdaysParse(input) % 7 || 7;
+// }
+// return isNaN(input) ? null : input;
+// }
// LOCALES
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 = [];
- this._shortWeekdaysParse = [];
- this._fullWeekdaysParse = [];
- }
-
- for (i = 0; i < 7; i++) {
- // make the regex if we don't have it already
-
- 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');
- this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
- }
- if (!this._weekdaysParse[i]) {
- regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
- this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
- // test the regex
- if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
- return i;
- } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
- return i;
- } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
- return i;
- } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
- return i;
- }
- }
-}
+// 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 = [];
+// this._shortWeekdaysParse = [];
+// this._fullWeekdaysParse = [];
+// }
+
+// for (i = 0; i < 7; i++) {
+// // make the regex if we don't have it already
+
+// 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');
+// this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
+// }
+// if (!this._weekdaysParse[i]) {
+// regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
+// this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
+// }
+// // test the regex
+// if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
+// return i;
+// } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
+// return i;
+// } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
+// return i;
+// } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
+// return i;
+// }
+// }
+// }
// MOMENTS
}
}
-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;
- }
-}
+// 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 () {
// PARSING
-addRegexToken('DDD', match1to3);
-addRegexToken('DDDD', match3);
-addParseToken(['DDD', 'DDDD'], function (input, array, config) {
- config._dayOfYear = toInt(input);
-});
+// addRegexToken('DDD', match1to3);
+// addRegexToken('DDDD', match3);
+// addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+// config._dayOfYear = toInt(input);
+// });
// HELPERS
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 { addRegexToken, match1to2, match2, match3to4, match5to6 } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { HOUR, MINUTE, SECOND } from './constants';
import toInt from '../utils/to-int';
import zeroFill from '../utils/zero-fill';
// PARSING
-function matchMeridiem (isStrict, locale) {
- return locale._meridiemParse;
-}
-
-addRegexToken('a', matchMeridiem);
-addRegexToken('A', matchMeridiem);
-addRegexToken('H', match1to2);
-addRegexToken('h', match1to2);
-addRegexToken('HH', match1to2, match2);
-addRegexToken('hh', match1to2, match2);
-
-addRegexToken('hmm', match3to4);
-addRegexToken('hmmss', match5to6);
-addRegexToken('Hmm', match3to4);
-addRegexToken('Hmmss', match5to6);
-
-addParseToken(['H', 'HH'], HOUR);
-addParseToken(['a', 'A'], function (input, array, config) {
- config._isPm = config._locale.isPM(input);
- config._meridiem = input;
-});
-addParseToken(['h', 'hh'], function (input, array, config) {
- array[HOUR] = toInt(input);
- getParsingFlags(config).bigHour = true;
-});
-addParseToken('hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
- getParsingFlags(config).bigHour = true;
-});
-addParseToken('hmmss', function (input, array, config) {
- var pos1 = input.length - 4;
- var pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
- getParsingFlags(config).bigHour = true;
-});
-addParseToken('Hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
-});
-addParseToken('Hmmss', function (input, array, config) {
- var pos1 = input.length - 4;
- var pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
-});
+// function matchMeridiem (isStrict, locale) {
+// return locale._meridiemParse;
+// }
+
+// addRegexToken('a', matchMeridiem);
+// addRegexToken('A', matchMeridiem);
+// addRegexToken('H', match1to2);
+// addRegexToken('h', match1to2);
+// addRegexToken('HH', match1to2, match2);
+// addRegexToken('hh', match1to2, match2);
+
+// addRegexToken('hmm', match3to4);
+// addRegexToken('hmmss', match5to6);
+// addRegexToken('Hmm', match3to4);
+// addRegexToken('Hmmss', match5to6);
+
+// addParseToken(['H', 'HH'], HOUR);
+// addParseToken(['a', 'A'], function (input, array, config) {
+// config._isPm = config._locale.isPM(input);
+// config._meridiem = input;
+// });
+// addParseToken(['h', 'hh'], function (input, array, config) {
+// array[HOUR] = toInt(input);
+// getParsingFlags(config).bigHour = true;
+// });
+// addParseToken('hmm', function (input, array, config) {
+// var pos = input.length - 2;
+// array[HOUR] = toInt(input.substr(0, pos));
+// array[MINUTE] = toInt(input.substr(pos));
+// getParsingFlags(config).bigHour = true;
+// });
+// addParseToken('hmmss', function (input, array, config) {
+// var pos1 = input.length - 4;
+// var pos2 = input.length - 2;
+// array[HOUR] = toInt(input.substr(0, pos1));
+// array[MINUTE] = toInt(input.substr(pos1, 2));
+// array[SECOND] = toInt(input.substr(pos2));
+// getParsingFlags(config).bigHour = true;
+// });
+// addParseToken('Hmm', function (input, array, config) {
+// var pos = input.length - 2;
+// array[HOUR] = toInt(input.substr(0, pos));
+// array[MINUTE] = toInt(input.substr(pos));
+// });
+// addParseToken('Hmmss', function (input, array, config) {
+// var pos1 = input.length - 4;
+// var pos2 = input.length - 2;
+// array[HOUR] = toInt(input.substr(0, pos1));
+// array[MINUTE] = toInt(input.substr(pos1, 2));
+// array[SECOND] = toInt(input.substr(pos2));
+// });
// LOCALES
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 { addRegexToken, match1, match2, match3, match1to3, matchUnsigned } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { MILLISECOND } from './constants';
import toInt from '../utils/to-int';
// PARSING
-addRegexToken('S', match1to3, match1);
-addRegexToken('SS', match1to3, match2);
-addRegexToken('SSS', match1to3, match3);
+// addRegexToken('S', match1to3, match1);
+// addRegexToken('SS', match1to3, match2);
+// addRegexToken('SSS', match1to3, match3);
-var token;
-for (token = 'SSSS'; token.length <= 9; token += 'S') {
- addRegexToken(token, matchUnsigned);
-}
+// var token;
+// for (token = 'SSSS'; token.length <= 9; token += 'S') {
+// addRegexToken(token, matchUnsigned);
+// }
-function parseMs(input, array) {
- array[MILLISECOND] = toInt(('0.' + input) * 1000);
-}
+// function parseMs(input, array) {
+// array[MILLISECOND] = toInt(('0.' + input) * 1000);
+// }
-for (token = 'S'; token.length <= 9; token += 'S') {
- addParseToken(token, parseMs);
-}
+// for (token = 'S'; token.length <= 9; token += 'S') {
+// addParseToken(token, parseMs);
+// }
// MOMENTS
export var getSetMillisecond = makeGetSet('Milliseconds', false);
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 { addRegexToken, match1to2, match2 } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { MINUTE } from './constants';
// FORMATTING
// PARSING
-addRegexToken('m', match1to2);
-addRegexToken('mm', match1to2, match2);
-addParseToken(['m', 'mm'], MINUTE);
+// addRegexToken('m', match1to2);
+// addRegexToken('mm', match1to2, match2);
+// addParseToken(['m', 'mm'], MINUTE);
// MOMENTS
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 { 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';
// PARSING
-addRegexToken('M', match1to2);
-addRegexToken('MM', match1to2, match2);
-addRegexToken('MMM', function (isStrict, locale) {
- return locale.monthsShortRegex(isStrict);
-});
-addRegexToken('MMMM', function (isStrict, locale) {
- return locale.monthsRegex(isStrict);
-});
-
-addParseToken(['M', 'MM'], function (input, array) {
- array[MONTH] = toInt(input) - 1;
-});
-
-addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
- var month = config._locale.monthsParse(input, token, config._strict);
- // if we didn't find a month name, mark the date as invalid.
- if (month != null) {
- array[MONTH] = month;
- } else {
- getParsingFlags(config).invalidMonth = input;
- }
-});
+// addRegexToken('M', match1to2);
+// addRegexToken('MM', match1to2, match2);
+// addRegexToken('MMM', function (isStrict, locale) {
+// return locale.monthsShortRegex(isStrict);
+// });
+// addRegexToken('MMMM', function (isStrict, locale) {
+// return locale.monthsRegex(isStrict);
+// });
+
+// addParseToken(['M', 'MM'], function (input, array) {
+// array[MONTH] = toInt(input) - 1;
+// });
+
+// addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
+// var month = config._locale.monthsParse(input, token, config._strict);
+// // if we didn't find a month name, mark the date as invalid.
+// if (month != null) {
+// array[MONTH] = month;
+// } else {
+// getParsingFlags(config).invalidMonth = input;
+// }
+// });
// LOCALES
}
}
-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]);
- if (strict && !this._longMonthsParse[i]) {
- this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
- this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
- }
- if (!strict && !this._monthsParse[i]) {
- regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
- this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
- // test the regex
- if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
- return i;
- } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
- return i;
- } else if (!strict && this._monthsParse[i].test(monthName)) {
- return i;
- }
- }
-}
+// 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]);
+// if (strict && !this._longMonthsParse[i]) {
+// this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
+// this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
+// }
+// if (!strict && !this._monthsParse[i]) {
+// regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+// this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
+// }
+// // test the regex
+// if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
+// return i;
+// } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
+// return i;
+// } else if (!strict && this._monthsParse[i].test(monthName)) {
+// return i;
+// }
+// }
+// }
// MOMENTS
return daysInMonth(this.year(), this.month());
}
-var defaultMonthsShortRegex = matchWord;
-export function monthsShortRegex (isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsShortStrictRegex;
- } else {
- return this._monthsShortRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsShortRegex')) {
- this._monthsShortRegex = defaultMonthsShortRegex;
- }
- return this._monthsShortStrictRegex && isStrict ?
- this._monthsShortStrictRegex : this._monthsShortRegex;
- }
-}
-
-var defaultMonthsRegex = matchWord;
-export function monthsRegex (isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsStrictRegex;
- } else {
- return this._monthsRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsRegex')) {
- this._monthsRegex = defaultMonthsRegex;
- }
- return this._monthsStrictRegex && isStrict ?
- this._monthsStrictRegex : this._monthsRegex;
- }
-}
-
-function computeMonthsParse () {
- function cmpLenRev(a, b) {
- return b.length - a.length;
- }
-
- var shortPieces = [], longPieces = [], mixedPieces = [],
- i, mom;
- for (i = 0; i < 12; i++) {
- // make the regex if we don't have it already
- mom = createUTC([2000, i]);
- shortPieces.push(this.monthsShort(mom, ''));
- longPieces.push(this.months(mom, ''));
- mixedPieces.push(this.months(mom, ''));
- mixedPieces.push(this.monthsShort(mom, ''));
- }
- // Sorting makes sure if one month (or abbr) is a prefix of another it
- // will match the longer piece.
- shortPieces.sort(cmpLenRev);
- longPieces.sort(cmpLenRev);
- mixedPieces.sort(cmpLenRev);
- 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');
-}
+// var defaultMonthsShortRegex = matchWord;
+// export function monthsShortRegex (isStrict) {
+// if (this._monthsParseExact) {
+// if (!hasOwnProp(this, '_monthsRegex')) {
+// computeMonthsParse.call(this);
+// }
+// if (isStrict) {
+// return this._monthsShortStrictRegex;
+// } else {
+// return this._monthsShortRegex;
+// }
+// } else {
+// if (!hasOwnProp(this, '_monthsShortRegex')) {
+// this._monthsShortRegex = defaultMonthsShortRegex;
+// }
+// return this._monthsShortStrictRegex && isStrict ?
+// this._monthsShortStrictRegex : this._monthsShortRegex;
+// }
+// }
+
+// var defaultMonthsRegex = matchWord;
+// export function monthsRegex (isStrict) {
+// if (this._monthsParseExact) {
+// if (!hasOwnProp(this, '_monthsRegex')) {
+// computeMonthsParse.call(this);
+// }
+// if (isStrict) {
+// return this._monthsStrictRegex;
+// } else {
+// return this._monthsRegex;
+// }
+// } else {
+// if (!hasOwnProp(this, '_monthsRegex')) {
+// this._monthsRegex = defaultMonthsRegex;
+// }
+// return this._monthsStrictRegex && isStrict ?
+// this._monthsStrictRegex : this._monthsRegex;
+// }
+// }
+
+// function computeMonthsParse () {
+// function cmpLenRev(a, b) {
+// return b.length - a.length;
+// }
+
+// var shortPieces = [], longPieces = [], mixedPieces = [],
+// i, mom;
+// for (i = 0; i < 12; i++) {
+// // make the regex if we don't have it already
+// mom = createUTC([2000, i]);
+// shortPieces.push(this.monthsShort(mom, ''));
+// longPieces.push(this.months(mom, ''));
+// mixedPieces.push(this.months(mom, ''));
+// mixedPieces.push(this.monthsShort(mom, ''));
+// }
+// // Sorting makes sure if one month (or abbr) is a prefix of another it
+// // will match the longer piece.
+// shortPieces.sort(cmpLenRev);
+// longPieces.sort(cmpLenRev);
+// mixedPieces.sort(cmpLenRev);
+// 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');
+// }
import { addSubtract } from '../moment/add-subtract';
import { isMoment, copyConfig } from '../moment/constructor';
import { addFormatToken } from '../format/format';
-import { addRegexToken, matchOffset, matchShortOffset } from '../parse/regex';
-import { addParseToken } from '../parse/token';
+// import { addRegexToken, matchOffset, matchShortOffset } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { createLocal } from '../create/local';
import { prepareConfig } from '../create/from-anything';
import { createUTC } from '../create/utc';
// PARSING
-addRegexToken('Z', matchShortOffset);
-addRegexToken('ZZ', matchShortOffset);
-addParseToken(['Z', 'ZZ'], function (input, array, config) {
- config._useUTC = true;
- config._tzm = offsetFromString(matchShortOffset, input);
-});
+// addRegexToken('Z', matchShortOffset);
+// addRegexToken('ZZ', matchShortOffset);
+// addParseToken(['Z', 'ZZ'], function (input, array, config) {
+// config._useUTC = true;
+// config._tzm = offsetFromString(matchShortOffset, input);
+// });
// HELPERS
// PARSING
-addRegexToken('Q', match1);
-addParseToken('Q', function (input, array) {
- array[MONTH] = (toInt(input) - 1) * 3;
-});
+// addRegexToken('Q', match1);
+// addParseToken('Q', function (input, array) {
+// array[MONTH] = (toInt(input) - 1) * 3;
+// });
// MOMENTS
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 { addRegexToken, match1to2, match2 } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { SECOND } from './constants';
// FORMATTING
addUnitPriority('second', 15);
-// PARSING
+// // PARSING
-addRegexToken('s', match1to2);
-addRegexToken('ss', match1to2, match2);
-addParseToken(['s', 'ss'], SECOND);
+// addRegexToken('s', match1to2);
+// addRegexToken('ss', match1to2, match2);
+// addParseToken(['s', 'ss'], SECOND);
// MOMENTS
// PARSING
-addRegexToken('x', matchSigned);
-addRegexToken('X', matchTimestamp);
-addParseToken('X', function (input, array, config) {
- config._d = new Date(parseFloat(input, 10) * 1000);
-});
-addParseToken('x', function (input, array, config) {
- config._d = new Date(toInt(input));
-});
+// addRegexToken('x', matchSigned);
+// addRegexToken('X', matchTimestamp);
+// addParseToken('X', function (input, array, config) {
+// config._d = new Date(parseFloat(input, 10) * 1000);
+// });
+// addParseToken('x', function (input, array, config) {
+// config._d = new Date(toInt(input));
+// });
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 { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex';
+// import { addWeekParseToken } from '../parse/token';
import { weekOfYear, weeksInYear, dayOfYearFromWeeks } from './week-calendar-utils';
import toInt from '../utils/to-int';
import { hooks } from '../utils/hooks';
// PARSING
-addRegexToken('G', matchSigned);
-addRegexToken('g', matchSigned);
-addRegexToken('GG', match1to2, match2);
-addRegexToken('gg', match1to2, match2);
-addRegexToken('GGGG', match1to4, match4);
-addRegexToken('gggg', match1to4, match4);
-addRegexToken('GGGGG', match1to6, match6);
-addRegexToken('ggggg', match1to6, match6);
-
-addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
- week[token.substr(0, 2)] = toInt(input);
-});
-
-addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
- week[token] = hooks.parseTwoDigitYear(input);
-});
+// addRegexToken('G', matchSigned);
+// addRegexToken('g', matchSigned);
+// addRegexToken('GG', match1to2, match2);
+// addRegexToken('gg', match1to2, match2);
+// addRegexToken('GGGG', match1to4, match4);
+// addRegexToken('gggg', match1to4, match4);
+// addRegexToken('GGGGG', match1to6, match6);
+// addRegexToken('ggggg', match1to6, match6);
+
+// addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
+// week[token.substr(0, 2)] = toInt(input);
+// });
+
+// addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
+// week[token] = hooks.parseTwoDigitYear(input);
+// });
// MOMENTS
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 { addRegexToken, match1to2, match2 } from '../parse/regex';
+// import { addWeekParseToken } from '../parse/token';
import toInt from '../utils/to-int';
import { createLocal } from '../create/local';
import { weekOfYear } from './week-calendar-utils';
// PARSING
-addRegexToken('w', match1to2);
-addRegexToken('ww', match1to2, match2);
-addRegexToken('W', match1to2);
-addRegexToken('WW', match1to2, match2);
+// addRegexToken('w', match1to2);
+// addRegexToken('ww', match1to2, match2);
+// addRegexToken('W', match1to2);
+// addRegexToken('WW', match1to2, match2);
-addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
- week[token.substr(0, 1)] = toInt(input);
-});
+// addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
+// week[token.substr(0, 1)] = toInt(input);
+// });
// HELPERS
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 { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex';
+// import { addParseToken } from '../parse/token';
import { hooks } from '../utils/hooks';
import { YEAR } from './constants';
import toInt from '../utils/to-int';
addUnitPriority('year', 1);
-// PARSING
-
-addRegexToken('Y', matchSigned);
-addRegexToken('YY', match1to2, match2);
-addRegexToken('YYYY', match1to4, match4);
-addRegexToken('YYYYY', match1to6, match6);
-addRegexToken('YYYYYY', match1to6, match6);
-
-addParseToken(['YYYYY', 'YYYYYY'], YEAR);
-addParseToken('YYYY', function (input, array) {
- array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
-});
-addParseToken('YY', function (input, array) {
- array[YEAR] = hooks.parseTwoDigitYear(input);
-});
-addParseToken('Y', function (input, array) {
- array[YEAR] = parseInt(input, 10);
-});
+// // PARSING
+
+// addRegexToken('Y', matchSigned);
+// addRegexToken('YY', match1to2, match2);
+// addRegexToken('YYYY', match1to4, match4);
+// addRegexToken('YYYYY', match1to6, match6);
+// addRegexToken('YYYYYY', match1to6, match6);
+
+// addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+// addParseToken('YYYY', function (input, array) {
+// array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
+// });
+// addParseToken('YY', function (input, array) {
+// array[YEAR] = hooks.parseTwoDigitYear(input);
+// });
+// addParseToken('Y', function (input, array) {
+// array[YEAR] = parseInt(input, 10);
+// });
// HELPERS