Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

View File

@ -0,0 +1,64 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { dayPeriodEnumToHours } from "../utils.js";
export var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {
_inherits(AMPMMidnightParser, _Parser);
var _super = _createSuper(AMPMMidnightParser);
function AMPMMidnightParser() {
var _this;
_classCallCheck(this, AMPMMidnightParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 80);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'B', 'H', 'k', 't', 'T']);
return _this;
}
_createClass(AMPMMidnightParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'b':
case 'bb':
case 'bbb':
return match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'bbbbb':
return match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'bbbb':
default:
return match.dayPeriod(dateString, {
width: 'wide',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
return date;
}
}]);
return AMPMMidnightParser;
}(Parser);

View File

@ -0,0 +1,64 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { dayPeriodEnumToHours } from "../utils.js";
export var AMPMParser = /*#__PURE__*/function (_Parser) {
_inherits(AMPMParser, _Parser);
var _super = _createSuper(AMPMParser);
function AMPMParser() {
var _this;
_classCallCheck(this, AMPMParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 80);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['b', 'B', 'H', 'k', 't', 'T']);
return _this;
}
_createClass(AMPMParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'a':
case 'aa':
case 'aaa':
return match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'aaaaa':
return match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'aaaa':
default:
return match.dayPeriod(dateString, {
width: 'wide',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
return date;
}
}]);
return AMPMParser;
}(Parser);

View File

@ -0,0 +1,64 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { isLeapYearIndex, parseNDigits, parseNumericPattern } from "../utils.js";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Day of the month
export var DateParser = /*#__PURE__*/function (_Parser) {
_inherits(DateParser, _Parser);
var _super = _createSuper(DateParser);
function DateParser() {
var _this;
_classCallCheck(this, DateParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "subPriority", 1);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(DateParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'd':
return parseNumericPattern(numericPatterns.date, dateString);
case 'do':
return match.ordinalNumber(dateString, {
unit: 'date'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(date, value) {
var year = date.getUTCFullYear();
var isLeapYear = isLeapYearIndex(year);
var month = date.getUTCMonth();
if (isLeapYear) {
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
} else {
return value >= 1 && value <= DAYS_IN_MONTH[month];
}
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCDate(value);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return DateParser;
}(Parser);

View File

@ -0,0 +1,60 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits, isLeapYearIndex } from "../utils.js";
export var DayOfYearParser = /*#__PURE__*/function (_Parser) {
_inherits(DayOfYearParser, _Parser);
var _super = _createSuper(DayOfYearParser);
function DayOfYearParser() {
var _this;
_classCallCheck(this, DayOfYearParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "subpriority", 1);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(DayOfYearParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'D':
case 'DD':
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
case 'Do':
return match.ordinalNumber(dateString, {
unit: 'date'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(date, value) {
var year = date.getUTCFullYear();
var isLeapYear = isLeapYearIndex(year);
if (isLeapYear) {
return value >= 1 && value <= 366;
} else {
return value >= 1 && value <= 365;
}
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMonth(0, value);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return DayOfYearParser;
}(Parser);

View File

@ -0,0 +1,88 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import setUTCDay from "../../../_lib/setUTCDay/index.js"; // Day of week
export var DayParser = /*#__PURE__*/function (_Parser) {
_inherits(DayParser, _Parser);
var _super = _createSuper(DayParser);
function DayParser() {
var _this;
_classCallCheck(this, DayParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['D', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(DayParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
// Tue
case 'E':
case 'EE':
case 'EEE':
return match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// T
case 'EEEEE':
return match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// Tu
case 'EEEEEE':
return match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// Tuesday
case 'EEEE':
default:
return match.day(dateString, {
width: 'wide',
context: 'formatting'
}) || match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 6;
}
}, {
key: "set",
value: function set(date, _flags, value, options) {
date = setUTCDay(date, value, options);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return DayParser;
}(Parser);

View File

@ -0,0 +1,64 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { dayPeriodEnumToHours } from "../utils.js"; // in the morning, in the afternoon, in the evening, at night
export var DayPeriodParser = /*#__PURE__*/function (_Parser) {
_inherits(DayPeriodParser, _Parser);
var _super = _createSuper(DayPeriodParser);
function DayPeriodParser() {
var _this;
_classCallCheck(this, DayPeriodParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 80);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 't', 'T']);
return _this;
}
_createClass(DayPeriodParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'B':
case 'BB':
case 'BBB':
return match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'BBBBB':
return match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
case 'BBBB':
default:
return match.dayPeriod(dateString, {
width: 'wide',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.dayPeriod(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
return date;
}
}]);
return DayPeriodParser;
}(Parser);

View File

@ -0,0 +1,62 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
export var EraParser = /*#__PURE__*/function (_Parser) {
_inherits(EraParser, _Parser);
var _super = _createSuper(EraParser);
function EraParser() {
var _this;
_classCallCheck(this, EraParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 140);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['R', 'u', 't', 'T']);
return _this;
}
_createClass(EraParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
// AD, BC
case 'G':
case 'GG':
case 'GGG':
return match.era(dateString, {
width: 'abbreviated'
}) || match.era(dateString, {
width: 'narrow'
});
// A, B
case 'GGGGG':
return match.era(dateString, {
width: 'narrow'
});
// Anno Domini, Before Christ
case 'GGGG':
default:
return match.era(dateString, {
width: 'wide'
}) || match.era(dateString, {
width: 'abbreviated'
}) || match.era(dateString, {
width: 'narrow'
});
}
}
}, {
key: "set",
value: function set(date, flags, value) {
flags.era = value;
date.setUTCFullYear(value, 0, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return EraParser;
}(Parser);

View File

@ -0,0 +1,40 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseNDigitsSigned } from "../utils.js";
export var ExtendedYearParser = /*#__PURE__*/function (_Parser) {
_inherits(ExtendedYearParser, _Parser);
var _super = _createSuper(ExtendedYearParser);
function ExtendedYearParser() {
var _this;
_classCallCheck(this, ExtendedYearParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 130);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(ExtendedYearParser, [{
key: "parse",
value: function parse(dateString, token) {
if (token === 'u') {
return parseNDigitsSigned(4, dateString);
}
return parseNDigitsSigned(token.length, dateString);
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCFullYear(value, 0, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return ExtendedYearParser;
}(Parser);

View File

@ -0,0 +1,39 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits } from "../utils.js";
export var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {
_inherits(FractionOfSecondParser, _Parser);
var _super = _createSuper(FractionOfSecondParser);
function FractionOfSecondParser() {
var _this;
_classCallCheck(this, FractionOfSecondParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 30);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
return _this;
}
_createClass(FractionOfSecondParser, [{
key: "parse",
value: function parse(dateString, token) {
var valueCallback = function valueCallback(value) {
return Math.floor(value * Math.pow(10, -token.length + 3));
};
return mapValue(parseNDigits(token.length, dateString), valueCallback);
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMilliseconds(value);
return date;
}
}]);
return FractionOfSecondParser;
}(Parser);

View File

@ -0,0 +1,56 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var Hour0To11Parser = /*#__PURE__*/function (_Parser) {
_inherits(Hour0To11Parser, _Parser);
var _super = _createSuper(Hour0To11Parser);
function Hour0To11Parser() {
var _this;
_classCallCheck(this, Hour0To11Parser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 70);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['h', 'H', 'k', 't', 'T']);
return _this;
}
_createClass(Hour0To11Parser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'K':
return parseNumericPattern(numericPatterns.hour11h, dateString);
case 'Ko':
return match.ordinalNumber(dateString, {
unit: 'hour'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 11;
}
}, {
key: "set",
value: function set(date, _flags, value) {
var isPM = date.getUTCHours() >= 12;
if (isPM && value < 12) {
date.setUTCHours(value + 12, 0, 0, 0);
} else {
date.setUTCHours(value, 0, 0, 0);
}
return date;
}
}]);
return Hour0To11Parser;
}(Parser);

View File

@ -0,0 +1,51 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var Hour0to23Parser = /*#__PURE__*/function (_Parser) {
_inherits(Hour0to23Parser, _Parser);
var _super = _createSuper(Hour0to23Parser);
function Hour0to23Parser() {
var _this;
_classCallCheck(this, Hour0to23Parser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 70);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'K', 'k', 't', 'T']);
return _this;
}
_createClass(Hour0to23Parser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'H':
return parseNumericPattern(numericPatterns.hour23h, dateString);
case 'Ho':
return match.ordinalNumber(dateString, {
unit: 'hour'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 23;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCHours(value, 0, 0, 0);
return date;
}
}]);
return Hour0to23Parser;
}(Parser);

View File

@ -0,0 +1,52 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var Hour1To24Parser = /*#__PURE__*/function (_Parser) {
_inherits(Hour1To24Parser, _Parser);
var _super = _createSuper(Hour1To24Parser);
function Hour1To24Parser() {
var _this;
_classCallCheck(this, Hour1To24Parser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 70);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['a', 'b', 'h', 'H', 'K', 't', 'T']);
return _this;
}
_createClass(Hour1To24Parser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'k':
return parseNumericPattern(numericPatterns.hour24h, dateString);
case 'ko':
return match.ordinalNumber(dateString, {
unit: 'hour'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 24;
}
}, {
key: "set",
value: function set(date, _flags, value) {
var hours = value <= 24 ? value % 24 : value;
date.setUTCHours(hours, 0, 0, 0);
return date;
}
}]);
return Hour1To24Parser;
}(Parser);

View File

@ -0,0 +1,58 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var Hour1to12Parser = /*#__PURE__*/function (_Parser) {
_inherits(Hour1to12Parser, _Parser);
var _super = _createSuper(Hour1to12Parser);
function Hour1to12Parser() {
var _this;
_classCallCheck(this, Hour1to12Parser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 70);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['H', 'K', 'k', 't', 'T']);
return _this;
}
_createClass(Hour1to12Parser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'h':
return parseNumericPattern(numericPatterns.hour12h, dateString);
case 'ho':
return match.ordinalNumber(dateString, {
unit: 'hour'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 12;
}
}, {
key: "set",
value: function set(date, _flags, value) {
var isPM = date.getUTCHours() >= 12;
if (isPM && value < 12) {
date.setUTCHours(value + 12, 0, 0, 0);
} else if (!isPM && value === 12) {
date.setUTCHours(0, 0, 0, 0);
} else {
date.setUTCHours(value, 0, 0, 0);
}
return date;
}
}]);
return Hour1to12Parser;
}(Parser);

View File

@ -0,0 +1,103 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits } from "../utils.js";
import setUTCISODay from "../../../_lib/setUTCISODay/index.js"; // ISO day of week
export var ISODayParser = /*#__PURE__*/function (_Parser) {
_inherits(ISODayParser, _Parser);
var _super = _createSuper(ISODayParser);
function ISODayParser() {
var _this;
_classCallCheck(this, ISODayParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(ISODayParser, [{
key: "parse",
value: function parse(dateString, token, match) {
var valueCallback = function valueCallback(value) {
if (value === 0) {
return 7;
}
return value;
};
switch (token) {
// 2
case 'i':
case 'ii':
// 02
return parseNDigits(token.length, dateString);
// 2nd
case 'io':
return match.ordinalNumber(dateString, {
unit: 'day'
});
// Tue
case 'iii':
return mapValue(match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
}), valueCallback);
// T
case 'iiiii':
return mapValue(match.day(dateString, {
width: 'narrow',
context: 'formatting'
}), valueCallback);
// Tu
case 'iiiiii':
return mapValue(match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
}), valueCallback);
// Tuesday
case 'iiii':
default:
return mapValue(match.day(dateString, {
width: 'wide',
context: 'formatting'
}) || match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
}), valueCallback);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 7;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date = setUTCISODay(date, value);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return ISODayParser;
}(Parser);

View File

@ -0,0 +1,51 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { timezonePatterns } from "../constants.js";
import { parseTimezonePattern } from "../utils.js"; // Timezone (ISO-8601)
export var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {
_inherits(ISOTimezoneParser, _Parser);
var _super = _createSuper(ISOTimezoneParser);
function ISOTimezoneParser() {
var _this;
_classCallCheck(this, ISOTimezoneParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 10);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'X']);
return _this;
}
_createClass(ISOTimezoneParser, [{
key: "parse",
value: function parse(dateString, token) {
switch (token) {
case 'x':
return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
case 'xx':
return parseTimezonePattern(timezonePatterns.basic, dateString);
case 'xxxx':
return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
case 'xxxxx':
return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
case 'xxx':
default:
return parseTimezonePattern(timezonePatterns.extended, dateString);
}
}
}, {
key: "set",
value: function set(date, flags, value) {
if (flags.timestampIsSet) {
return date;
}
return new Date(date.getTime() - value);
}
}]);
return ISOTimezoneParser;
}(Parser);

View File

@ -0,0 +1,51 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { timezonePatterns } from "../constants.js";
import { parseTimezonePattern } from "../utils.js"; // Timezone (ISO-8601. +00:00 is `'Z'`)
export var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {
_inherits(ISOTimezoneWithZParser, _Parser);
var _super = _createSuper(ISOTimezoneWithZParser);
function ISOTimezoneWithZParser() {
var _this;
_classCallCheck(this, ISOTimezoneWithZParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 10);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T', 'x']);
return _this;
}
_createClass(ISOTimezoneWithZParser, [{
key: "parse",
value: function parse(dateString, token) {
switch (token) {
case 'X':
return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
case 'XX':
return parseTimezonePattern(timezonePatterns.basic, dateString);
case 'XXXX':
return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
case 'XXXXX':
return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
case 'XXX':
default:
return parseTimezonePattern(timezonePatterns.extended, dateString);
}
}
}, {
key: "set",
value: function set(date, flags, value) {
if (flags.timestampIsSet) {
return date;
}
return new Date(date.getTime() - value);
}
}]);
return ISOTimezoneWithZParser;
}(Parser);

View File

@ -0,0 +1,52 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
import setUTCISOWeek from "../../../_lib/setUTCISOWeek/index.js";
import startOfUTCISOWeek from "../../../_lib/startOfUTCISOWeek/index.js"; // ISO week of year
export var ISOWeekParser = /*#__PURE__*/function (_Parser) {
_inherits(ISOWeekParser, _Parser);
var _super = _createSuper(ISOWeekParser);
function ISOWeekParser() {
var _this;
_classCallCheck(this, ISOWeekParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 100);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(ISOWeekParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'I':
return parseNumericPattern(numericPatterns.week, dateString);
case 'Io':
return match.ordinalNumber(dateString, {
unit: 'week'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 53;
}
}, {
key: "set",
value: function set(date, _flags, value) {
return startOfUTCISOWeek(setUTCISOWeek(date, value));
}
}]);
return ISOWeekParser;
}(Parser);

View File

@ -0,0 +1,42 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseNDigitsSigned } from "../utils.js";
import startOfUTCISOWeek from "../../../_lib/startOfUTCISOWeek/index.js"; // ISO week-numbering year
export var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {
_inherits(ISOWeekYearParser, _Parser);
var _super = _createSuper(ISOWeekYearParser);
function ISOWeekYearParser() {
var _this;
_classCallCheck(this, ISOWeekYearParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 130);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(ISOWeekYearParser, [{
key: "parse",
value: function parse(dateString, token) {
if (token === 'R') {
return parseNDigitsSigned(4, dateString);
}
return parseNDigitsSigned(token.length, dateString);
}
}, {
key: "set",
value: function set(_date, _flags, value) {
var firstWeekOfYear = new Date(0);
firstWeekOfYear.setUTCFullYear(value, 0, 4);
firstWeekOfYear.setUTCHours(0, 0, 0, 0);
return startOfUTCISOWeek(firstWeekOfYear);
}
}]);
return ISOWeekYearParser;
}(Parser);

View File

@ -0,0 +1,101 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits } from "../utils.js";
import setUTCDay from "../../../_lib/setUTCDay/index.js"; // Local day of week
export var LocalDayParser = /*#__PURE__*/function (_Parser) {
_inherits(LocalDayParser, _Parser);
var _super = _createSuper(LocalDayParser);
function LocalDayParser() {
var _this;
_classCallCheck(this, LocalDayParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);
return _this;
}
_createClass(LocalDayParser, [{
key: "parse",
value: function parse(dateString, token, match, options) {
var valueCallback = function valueCallback(value) {
var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
};
switch (token) {
// 3
case 'e':
case 'ee':
// 03
return mapValue(parseNDigits(token.length, dateString), valueCallback);
// 3rd
case 'eo':
return mapValue(match.ordinalNumber(dateString, {
unit: 'day'
}), valueCallback);
// Tue
case 'eee':
return match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// T
case 'eeeee':
return match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// Tu
case 'eeeeee':
return match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
// Tuesday
case 'eeee':
default:
return match.day(dateString, {
width: 'wide',
context: 'formatting'
}) || match.day(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.day(dateString, {
width: 'short',
context: 'formatting'
}) || match.day(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 6;
}
}, {
key: "set",
value: function set(date, _flags, value, options) {
date = setUTCDay(date, value, options);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return LocalDayParser;
}(Parser);

View File

@ -0,0 +1,52 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
import setUTCWeek from "../../../_lib/setUTCWeek/index.js";
import startOfUTCWeek from "../../../_lib/startOfUTCWeek/index.js"; // Local week of year
export var LocalWeekParser = /*#__PURE__*/function (_Parser) {
_inherits(LocalWeekParser, _Parser);
var _super = _createSuper(LocalWeekParser);
function LocalWeekParser() {
var _this;
_classCallCheck(this, LocalWeekParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 100);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
return _this;
}
_createClass(LocalWeekParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'w':
return parseNumericPattern(numericPatterns.week, dateString);
case 'wo':
return match.ordinalNumber(dateString, {
unit: 'week'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 53;
}
}, {
key: "set",
value: function set(date, _flags, value, options) {
return startOfUTCWeek(setUTCWeek(date, value, options), options);
}
}]);
return LocalWeekParser;
}(Parser);

View File

@ -0,0 +1,68 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseNDigits, normalizeTwoDigitYear, mapValue } from "../utils.js";
import getUTCWeekYear from "../../../_lib/getUTCWeekYear/index.js";
import startOfUTCWeek from "../../../_lib/startOfUTCWeek/index.js";
// Local week-numbering year
export var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {
_inherits(LocalWeekYearParser, _Parser);
var _super = _createSuper(LocalWeekYearParser);
function LocalWeekYearParser() {
var _this;
_classCallCheck(this, LocalWeekYearParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 130);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);
return _this;
}
_createClass(LocalWeekYearParser, [{
key: "parse",
value: function parse(dateString, token, match) {
var valueCallback = function valueCallback(year) {
return {
year: year,
isTwoDigitYear: token === 'YY'
};
};
switch (token) {
case 'Y':
return mapValue(parseNDigits(4, dateString), valueCallback);
case 'Yo':
return mapValue(match.ordinalNumber(dateString, {
unit: 'year'
}), valueCallback);
default:
return mapValue(parseNDigits(token.length, dateString), valueCallback);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value.isTwoDigitYear || value.year > 0;
}
}, {
key: "set",
value: function set(date, flags, value, options) {
var currentYear = getUTCWeekYear(date, options);
if (value.isTwoDigitYear) {
var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
date.setUTCHours(0, 0, 0, 0);
return startOfUTCWeek(date, options);
}
var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
date.setUTCHours(0, 0, 0, 0);
return startOfUTCWeek(date, options);
}
}]);
return LocalWeekYearParser;
}(Parser);

View File

@ -0,0 +1,51 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var MinuteParser = /*#__PURE__*/function (_Parser) {
_inherits(MinuteParser, _Parser);
var _super = _createSuper(MinuteParser);
function MinuteParser() {
var _this;
_classCallCheck(this, MinuteParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 60);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
return _this;
}
_createClass(MinuteParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 'm':
return parseNumericPattern(numericPatterns.minute, dateString);
case 'mo':
return match.ordinalNumber(dateString, {
unit: 'minute'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 59;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMinutes(value, 0, 0);
return date;
}
}]);
return MinuteParser;
}(Parser);

View File

@ -0,0 +1,86 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { mapValue, parseNDigits, parseNumericPattern } from "../utils.js";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
export var MonthParser = /*#__PURE__*/function (_Parser) {
_inherits(MonthParser, _Parser);
var _super = _createSuper(MonthParser);
function MonthParser() {
var _this;
_classCallCheck(this, MonthParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
_defineProperty(_assertThisInitialized(_this), "priority", 110);
return _this;
}
_createClass(MonthParser, [{
key: "parse",
value: function parse(dateString, token, match) {
var valueCallback = function valueCallback(value) {
return value - 1;
};
switch (token) {
// 1, 2, ..., 12
case 'M':
return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
// 01, 02, ..., 12
case 'MM':
return mapValue(parseNDigits(2, dateString), valueCallback);
// 1st, 2nd, ..., 12th
case 'Mo':
return mapValue(match.ordinalNumber(dateString, {
unit: 'month'
}), valueCallback);
// Jan, Feb, ..., Dec
case 'MMM':
return match.month(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.month(dateString, {
width: 'narrow',
context: 'formatting'
});
// J, F, ..., D
case 'MMMMM':
return match.month(dateString, {
width: 'narrow',
context: 'formatting'
});
// January, February, ..., December
case 'MMMM':
default:
return match.month(dateString, {
width: 'wide',
context: 'formatting'
}) || match.month(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.month(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 11;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMonth(value, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return MonthParser;
}(Parser);

View File

@ -0,0 +1,81 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseNDigits } from "../utils.js";
export var QuarterParser = /*#__PURE__*/function (_Parser) {
_inherits(QuarterParser, _Parser);
var _super = _createSuper(QuarterParser);
function QuarterParser() {
var _this;
_classCallCheck(this, QuarterParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 120);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(QuarterParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
// 1, 2, 3, 4
case 'Q':
case 'QQ':
// 01, 02, 03, 04
return parseNDigits(token.length, dateString);
// 1st, 2nd, 3rd, 4th
case 'Qo':
return match.ordinalNumber(dateString, {
unit: 'quarter'
});
// Q1, Q2, Q3, Q4
case 'QQQ':
return match.quarter(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.quarter(dateString, {
width: 'narrow',
context: 'formatting'
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case 'QQQQQ':
return match.quarter(dateString, {
width: 'narrow',
context: 'formatting'
});
// 1st quarter, 2nd quarter, ...
case 'QQQQ':
default:
return match.quarter(dateString, {
width: 'wide',
context: 'formatting'
}) || match.quarter(dateString, {
width: 'abbreviated',
context: 'formatting'
}) || match.quarter(dateString, {
width: 'narrow',
context: 'formatting'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 4;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMonth((value - 1) * 3, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return QuarterParser;
}(Parser);

View File

@ -0,0 +1,51 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits } from "../utils.js";
export var SecondParser = /*#__PURE__*/function (_Parser) {
_inherits(SecondParser, _Parser);
var _super = _createSuper(SecondParser);
function SecondParser() {
var _this;
_classCallCheck(this, SecondParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 50);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['t', 'T']);
return _this;
}
_createClass(SecondParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
case 's':
return parseNumericPattern(numericPatterns.second, dateString);
case 'so':
return match.ordinalNumber(dateString, {
unit: 'second'
});
default:
return parseNDigits(token.length, dateString);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 59;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCSeconds(value, 0);
return date;
}
}]);
return SecondParser;
}(Parser);

View File

@ -0,0 +1,101 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { mapValue, parseNDigits } from "../utils.js";
import setUTCDay from "../../../_lib/setUTCDay/index.js"; // Stand-alone local day of week
export var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {
_inherits(StandAloneLocalDayParser, _Parser);
var _super = _createSuper(StandAloneLocalDayParser);
function StandAloneLocalDayParser() {
var _this;
_classCallCheck(this, StandAloneLocalDayParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 90);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);
return _this;
}
_createClass(StandAloneLocalDayParser, [{
key: "parse",
value: function parse(dateString, token, match, options) {
var valueCallback = function valueCallback(value) {
var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
};
switch (token) {
// 3
case 'c':
case 'cc':
// 03
return mapValue(parseNDigits(token.length, dateString), valueCallback);
// 3rd
case 'co':
return mapValue(match.ordinalNumber(dateString, {
unit: 'day'
}), valueCallback);
// Tue
case 'ccc':
return match.day(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.day(dateString, {
width: 'short',
context: 'standalone'
}) || match.day(dateString, {
width: 'narrow',
context: 'standalone'
});
// T
case 'ccccc':
return match.day(dateString, {
width: 'narrow',
context: 'standalone'
});
// Tu
case 'cccccc':
return match.day(dateString, {
width: 'short',
context: 'standalone'
}) || match.day(dateString, {
width: 'narrow',
context: 'standalone'
});
// Tuesday
case 'cccc':
default:
return match.day(dateString, {
width: 'wide',
context: 'standalone'
}) || match.day(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.day(dateString, {
width: 'short',
context: 'standalone'
}) || match.day(dateString, {
width: 'narrow',
context: 'standalone'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 6;
}
}, {
key: "set",
value: function set(date, _flags, value, options) {
date = setUTCDay(date, value, options);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return StandAloneLocalDayParser;
}(Parser);

View File

@ -0,0 +1,86 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { numericPatterns } from "../constants.js";
import { parseNumericPattern, parseNDigits, mapValue } from "../utils.js";
export var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {
_inherits(StandAloneMonthParser, _Parser);
var _super = _createSuper(StandAloneMonthParser);
function StandAloneMonthParser() {
var _this;
_classCallCheck(this, StandAloneMonthParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 110);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(StandAloneMonthParser, [{
key: "parse",
value: function parse(dateString, token, match) {
var valueCallback = function valueCallback(value) {
return value - 1;
};
switch (token) {
// 1, 2, ..., 12
case 'L':
return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
// 01, 02, ..., 12
case 'LL':
return mapValue(parseNDigits(2, dateString), valueCallback);
// 1st, 2nd, ..., 12th
case 'Lo':
return mapValue(match.ordinalNumber(dateString, {
unit: 'month'
}), valueCallback);
// Jan, Feb, ..., Dec
case 'LLL':
return match.month(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.month(dateString, {
width: 'narrow',
context: 'standalone'
});
// J, F, ..., D
case 'LLLLL':
return match.month(dateString, {
width: 'narrow',
context: 'standalone'
});
// January, February, ..., December
case 'LLLL':
default:
return match.month(dateString, {
width: 'wide',
context: 'standalone'
}) || match.month(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.month(dateString, {
width: 'narrow',
context: 'standalone'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 0 && value <= 11;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMonth(value, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return StandAloneMonthParser;
}(Parser);

View File

@ -0,0 +1,81 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseNDigits } from "../utils.js";
export var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {
_inherits(StandAloneQuarterParser, _Parser);
var _super = _createSuper(StandAloneQuarterParser);
function StandAloneQuarterParser() {
var _this;
_classCallCheck(this, StandAloneQuarterParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 120);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(StandAloneQuarterParser, [{
key: "parse",
value: function parse(dateString, token, match) {
switch (token) {
// 1, 2, 3, 4
case 'q':
case 'qq':
// 01, 02, 03, 04
return parseNDigits(token.length, dateString);
// 1st, 2nd, 3rd, 4th
case 'qo':
return match.ordinalNumber(dateString, {
unit: 'quarter'
});
// Q1, Q2, Q3, Q4
case 'qqq':
return match.quarter(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.quarter(dateString, {
width: 'narrow',
context: 'standalone'
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case 'qqqqq':
return match.quarter(dateString, {
width: 'narrow',
context: 'standalone'
});
// 1st quarter, 2nd quarter, ...
case 'qqqq':
default:
return match.quarter(dateString, {
width: 'wide',
context: 'standalone'
}) || match.quarter(dateString, {
width: 'abbreviated',
context: 'standalone'
}) || match.quarter(dateString, {
width: 'narrow',
context: 'standalone'
});
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value >= 1 && value <= 4;
}
}, {
key: "set",
value: function set(date, _flags, value) {
date.setUTCMonth((value - 1) * 3, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return StandAloneQuarterParser;
}(Parser);

View File

@ -0,0 +1,37 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseAnyDigitsSigned } from "../utils.js";
export var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {
_inherits(TimestampMillisecondsParser, _Parser);
var _super = _createSuper(TimestampMillisecondsParser);
function TimestampMillisecondsParser() {
var _this;
_classCallCheck(this, TimestampMillisecondsParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 20);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
return _this;
}
_createClass(TimestampMillisecondsParser, [{
key: "parse",
value: function parse(dateString) {
return parseAnyDigitsSigned(dateString);
}
}, {
key: "set",
value: function set(_date, _flags, value) {
return [new Date(value), {
timestampIsSet: true
}];
}
}]);
return TimestampMillisecondsParser;
}(Parser);

View File

@ -0,0 +1,37 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { parseAnyDigitsSigned } from "../utils.js";
export var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {
_inherits(TimestampSecondsParser, _Parser);
var _super = _createSuper(TimestampSecondsParser);
function TimestampSecondsParser() {
var _this;
_classCallCheck(this, TimestampSecondsParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 40);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", '*');
return _this;
}
_createClass(TimestampSecondsParser, [{
key: "parse",
value: function parse(dateString) {
return parseAnyDigitsSigned(dateString);
}
}, {
key: "set",
value: function set(_date, _flags, value) {
return [new Date(value * 1000), {
timestampIsSet: true
}];
}
}]);
return TimestampSecondsParser;
}(Parser);

View File

@ -0,0 +1,73 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Parser } from "../Parser.js";
import { mapValue, normalizeTwoDigitYear, parseNDigits } from "../utils.js";
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
// | Year | y | yy | yyy | yyyy | yyyyy |
// |----------|-------|----|-------|-------|-------|
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
export var YearParser = /*#__PURE__*/function (_Parser) {
_inherits(YearParser, _Parser);
var _super = _createSuper(YearParser);
function YearParser() {
var _this;
_classCallCheck(this, YearParser);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "priority", 130);
_defineProperty(_assertThisInitialized(_this), "incompatibleTokens", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);
return _this;
}
_createClass(YearParser, [{
key: "parse",
value: function parse(dateString, token, match) {
var valueCallback = function valueCallback(year) {
return {
year: year,
isTwoDigitYear: token === 'yy'
};
};
switch (token) {
case 'y':
return mapValue(parseNDigits(4, dateString), valueCallback);
case 'yo':
return mapValue(match.ordinalNumber(dateString, {
unit: 'year'
}), valueCallback);
default:
return mapValue(parseNDigits(token.length, dateString), valueCallback);
}
}
}, {
key: "validate",
value: function validate(_date, value) {
return value.isTwoDigitYear || value.year > 0;
}
}, {
key: "set",
value: function set(date, flags, value) {
var currentYear = date.getUTCFullYear();
if (value.isTwoDigitYear) {
var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
date.setUTCFullYear(year, 0, 1);
date.setUTCHours(0, 0, 0, 0);
return date;
}
}]);
return YearParser;
}(Parser);

View File

@ -0,0 +1,107 @@
import { EraParser } from "./EraParser.js";
import { YearParser } from "./YearParser.js";
import { LocalWeekYearParser } from "./LocalWeekYearParser.js";
import { ISOWeekYearParser } from "./ISOWeekYearParser.js";
import { ExtendedYearParser } from "./ExtendedYearParser.js";
import { QuarterParser } from "./QuarterParser.js";
import { StandAloneQuarterParser } from "./StandAloneQuarterParser.js";
import { MonthParser } from "./MonthParser.js";
import { StandAloneMonthParser } from "./StandAloneMonthParser.js";
import { LocalWeekParser } from "./LocalWeekParser.js";
import { ISOWeekParser } from "./ISOWeekParser.js";
import { DateParser } from "./DateParser.js";
import { DayOfYearParser } from "./DayOfYearParser.js";
import { DayParser } from "./DayParser.js";
import { LocalDayParser } from "./LocalDayParser.js";
import { StandAloneLocalDayParser } from "./StandAloneLocalDayParser.js";
import { ISODayParser } from "./ISODayParser.js";
import { AMPMParser } from "./AMPMParser.js";
import { AMPMMidnightParser } from "./AMPMMidnightParser.js";
import { DayPeriodParser } from "./DayPeriodParser.js";
import { Hour1to12Parser } from "./Hour1to12Parser.js";
import { Hour0to23Parser } from "./Hour0to23Parser.js";
import { Hour0To11Parser } from "./Hour0To11Parser.js";
import { Hour1To24Parser } from "./Hour1To24Parser.js";
import { MinuteParser } from "./MinuteParser.js";
import { SecondParser } from "./SecondParser.js";
import { FractionOfSecondParser } from "./FractionOfSecondParser.js";
import { ISOTimezoneWithZParser } from "./ISOTimezoneWithZParser.js";
import { ISOTimezoneParser } from "./ISOTimezoneParser.js";
import { TimestampSecondsParser } from "./TimestampSecondsParser.js";
import { TimestampMillisecondsParser } from "./TimestampMillisecondsParser.js";
/*
* | | Unit | | Unit |
* |-----|--------------------------------|-----|--------------------------------|
* | a | AM, PM | A* | Milliseconds in day |
* | b | AM, PM, noon, midnight | B | Flexible day period |
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
* | d | Day of month | D | Day of year |
* | e | Local day of week | E | Day of week |
* | f | | F* | Day of week in month |
* | g* | Modified Julian day | G | Era |
* | h | Hour [1-12] | H | Hour [0-23] |
* | i! | ISO day of week | I! | ISO week of year |
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
* | k | Hour [1-24] | K | Hour [0-11] |
* | l* | (deprecated) | L | Stand-alone month |
* | m | Minute | M | Month |
* | n | | N | |
* | o! | Ordinal number modifier | O* | Timezone (GMT) |
* | p | | P | |
* | q | Stand-alone quarter | Q | Quarter |
* | r* | Related Gregorian year | R! | ISO week-numbering year |
* | s | Second | S | Fraction of second |
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
* | u | Extended year | U* | Cyclic year |
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
* | w | Local week of year | W* | Week of month |
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
* | y | Year (abs) | Y | Local week-numbering year |
* | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
*
* Letters marked by * are not implemented but reserved by Unicode standard.
*
* Letters marked by ! are non-standard, but implemented by date-fns:
* - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
* i.e. 7 for Sunday, 1 for Monday, etc.
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
* `R` is supposed to be used in conjunction with `I` and `i`
* for universal ISO week-numbering date, whereas
* `Y` is supposed to be used in conjunction with `w` and `e`
* for week-numbering date specific to the locale.
*/
export var parsers = {
G: new EraParser(),
y: new YearParser(),
Y: new LocalWeekYearParser(),
R: new ISOWeekYearParser(),
u: new ExtendedYearParser(),
Q: new QuarterParser(),
q: new StandAloneQuarterParser(),
M: new MonthParser(),
L: new StandAloneMonthParser(),
w: new LocalWeekParser(),
I: new ISOWeekParser(),
d: new DateParser(),
D: new DayOfYearParser(),
E: new DayParser(),
e: new LocalDayParser(),
c: new StandAloneLocalDayParser(),
i: new ISODayParser(),
a: new AMPMParser(),
b: new AMPMMidnightParser(),
B: new DayPeriodParser(),
h: new Hour1to12Parser(),
H: new Hour0to23Parser(),
K: new Hour0To11Parser(),
k: new Hour1To24Parser(),
m: new MinuteParser(),
s: new SecondParser(),
S: new FractionOfSecondParser(),
X: new ISOTimezoneWithZParser(),
x: new ISOTimezoneParser(),
t: new TimestampSecondsParser(),
T: new TimestampMillisecondsParser()
};