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);