luxon
Version:
Immutable date wrapper
1,982 lines (1,696 loc) • 213 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/*
This is just a junk drawer, containing anything used across multiple classes.
Because Luxon is small(ish), this should stay small and we won't worry about splitting
it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.
*/
/**
* @private
*/
// TYPES
function isUndefined(o) {
return typeof o === 'undefined';
}
function isNumber(o) {
return typeof o === 'number';
}
function isString(o) {
return typeof o === 'string';
}
function isDate(o) {
return Object.prototype.toString.call(o) === '[object Date]';
}
// CAPABILITIES
function hasIntl() {
return typeof Intl !== 'undefined' && Intl.DateTimeFormat;
}
function hasFormatToParts() {
return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);
}
// OBJECTS AND ARRAYS
function maybeArray(thing) {
return Array.isArray(thing) ? thing : [thing];
}
function bestBy(arr, by, compare) {
if (arr.length === 0) {
return undefined;
}
return arr.reduce(function (best, next) {
var pair = [by(next), next];
if (!best) {
return pair;
} else if (compare.apply(null, [best[0], pair[0]]) === best[0]) {
return best;
} else {
return pair;
}
}, null)[1];
}
function pick(obj, keys) {
return keys.reduce(function (a, k) {
a[k] = obj[k];
return a;
}, {});
}
// NUMBERS AND STRINGS
function numberBetween(thing, bottom, top) {
return isNumber(thing) && thing >= bottom && thing <= top;
}
// x % n but takes the sign of n instead of x
function floorMod(x, n) {
return x - n * Math.floor(x / n);
}
function padStart(input) {
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
if (input.toString().length < n) {
return ('0'.repeat(n) + input).slice(-n);
} else {
return input.toString();
}
}
function parseMillis(fraction) {
if (isUndefined(fraction)) {
return NaN;
} else {
var f = parseFloat('0.' + fraction) * 1000;
return Math.floor(f);
}
}
function roundTo(number, digits) {
var factor = Math.pow(10, digits);
return Math.round(number * factor) / factor;
}
// DATE BASICS
function isLeapYear(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function daysInMonth(year, month) {
var modMonth = floorMod(month - 1, 12) + 1,
modYear = year + (month - modMonth) / 12;
if (modMonth === 2) {
return isLeapYear(modYear) ? 29 : 28;
} else {
return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
}
}
function weeksInWeekYear(weekYear) {
var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7,
last = weekYear - 1,
p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
return p1 === 4 || p2 === 3 ? 53 : 52;
}
function untruncateYear(year) {
if (year > 99) {
return year;
} else return year > 60 ? 1900 + year : 2000 + year;
}
// PARSING
function parseZoneInfo(ts, offsetFormat, locale) {
var timeZone = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var date = new Date(ts),
intlOpts = {
hour12: false,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
};
if (timeZone) {
intlOpts.timeZone = timeZone;
}
var modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),
intl = hasIntl();
if (intl && hasFormatToParts()) {
var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) {
return m.type.toLowerCase() === 'timezonename';
});
return parsed ? parsed.value : null;
} else if (intl) {
// this probably doesn't work for all locales
var without = new Intl.DateTimeFormat(locale, intlOpts).format(date),
included = new Intl.DateTimeFormat(locale, modified).format(date),
diffed = included.substring(without.length),
trimmed = diffed.replace(/^[, ]+/, '');
return trimmed;
} else {
return null;
}
}
// signedOffset('-5', '30') -> -330
function signedOffset(offHourStr, offMinuteStr) {
var offHour = parseInt(offHourStr, 10) || 0,
offMin = parseInt(offMinuteStr, 10) || 0,
offMinSigned = offHour < 0 ? -offMin : offMin;
return offHour * 60 + offMinSigned;
}
// COERCION
function normalizeObject(obj, normalizer) {
var ignoreUnknown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var normalized = {};
for (var u in obj) {
if (obj.hasOwnProperty(u)) {
var v = obj[u];
if (v !== null && !isUndefined(v) && !Number.isNaN(v)) {
var mapped = normalizer(u, ignoreUnknown);
if (mapped) {
normalized[mapped] = v;
}
}
}
}
return normalized;
}
function timeObject(obj) {
return pick(obj, ['hour', 'minute', 'second', 'millisecond']);
}
/**
* @private
*/
var n = 'numeric',
s = 'short',
l = 'long',
d2 = '2-digit';
var DATE_SHORT = {
year: n,
month: n,
day: n
};
var DATE_MED = {
year: n,
month: s,
day: n
};
var DATE_FULL = {
year: n,
month: l,
day: n
};
var DATE_HUGE = {
year: n,
month: l,
day: n,
weekday: l
};
var TIME_SIMPLE = {
hour: n,
minute: d2
};
var TIME_WITH_SECONDS = {
hour: n,
minute: d2,
second: d2
};
var TIME_WITH_SHORT_OFFSET = {
hour: n,
minute: d2,
second: d2,
timeZoneName: s
};
var TIME_WITH_LONG_OFFSET = {
hour: n,
minute: d2,
second: d2,
timeZoneName: l
};
var TIME_24_SIMPLE = {
hour: n,
minute: d2,
hour12: false
};
/**
* {@link toLocaleString}; format like '09:30:23', always 24-hour.
*/
var TIME_24_WITH_SECONDS = {
hour: n,
minute: d2,
second: d2,
hour12: false
};
/**
* {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.
*/
var TIME_24_WITH_SHORT_OFFSET = {
hour: n,
minute: d2,
second: d2,
hour12: false,
timeZoneName: s
};
/**
* {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.
*/
var TIME_24_WITH_LONG_OFFSET = {
hour: n,
minute: d2,
second: d2,
hour12: false,
timeZoneName: l
};
/**
* {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
*/
var DATETIME_SHORT = {
year: n,
month: n,
day: n,
hour: n,
minute: d2
};
/**
* {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
*/
var DATETIME_SHORT_WITH_SECONDS = {
year: n,
month: n,
day: n,
hour: n,
minute: d2,
second: d2
};
var DATETIME_MED = {
year: n,
month: s,
day: n,
hour: n,
minute: d2
};
var DATETIME_MED_WITH_SECONDS = {
year: n,
month: s,
day: n,
hour: n,
minute: d2,
second: d2
};
var DATETIME_FULL = {
year: n,
month: l,
day: n,
hour: n,
minute: d2,
timeZoneName: s
};
var DATETIME_FULL_WITH_SECONDS = {
year: n,
month: l,
day: n,
hour: n,
minute: d2,
second: d2,
timeZoneName: s
};
var DATETIME_HUGE = {
year: n,
month: l,
day: n,
weekday: l,
hour: n,
minute: d2,
timeZoneName: l
};
var DATETIME_HUGE_WITH_SECONDS = {
year: n,
month: l,
day: n,
weekday: l,
hour: n,
minute: d2,
second: d2,
timeZoneName: l
};
function stringify(obj) {
return JSON.stringify(obj, Object.keys(obj).sort());
}
/**
* @private
*/
var monthsLong = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var monthsNarrow = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];
function months(length) {
switch (length) {
case 'narrow':
return monthsNarrow;
case 'short':
return monthsShort;
case 'long':
return monthsLong;
case 'numeric':
return ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
case '2-digit':
return ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
default:
return null;
}
}
var weekdaysLong = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
var weekdaysShort = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
var weekdaysNarrow = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
function weekdays(length) {
switch (length) {
case 'narrow':
return weekdaysNarrow;
case 'short':
return weekdaysShort;
case 'long':
return weekdaysLong;
case 'numeric':
return ['1', '2', '3', '4', '5', '6', '7'];
default:
return null;
}
}
var meridiems = ['AM', 'PM'];
var erasLong = ['Before Christ', 'Anno Domini'];
var erasShort = ['BC', 'AD'];
var erasNarrow = ['B', 'A'];
function eras(length) {
switch (length) {
case 'narrow':
return erasNarrow;
case 'short':
return erasShort;
case 'long':
return erasLong;
default:
return null;
}
}
function meridiemForDateTime(dt) {
return meridiems[dt.hour < 12 ? 0 : 1];
}
function weekdayForDateTime(dt, length) {
return weekdays(length)[dt.weekday - 1];
}
function monthForDateTime(dt, length) {
return months(length)[dt.month - 1];
}
function eraForDateTime(dt, length) {
return eras(length)[dt.year < 0 ? 0 : 1];
}
function formatString(knownFormat) {
// these all have the offsets removed because we don't have access to them
// without all the intl stuff this is backfilling
var filtered = pick(knownFormat, ['weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName', 'hour12']),
key = stringify(filtered),
dateTimeHuge = 'EEEE, LLLL d, yyyy, h:mm a';
switch (key) {
case stringify(DATE_SHORT):
return 'M/d/yyyy';
case stringify(DATE_MED):
return 'LLL d, yyyy';
case stringify(DATE_FULL):
return 'LLLL d, yyyy';
case stringify(DATE_HUGE):
return 'EEEE, LLLL d, yyyy';
case stringify(TIME_SIMPLE):
return 'h:mm a';
case stringify(TIME_WITH_SECONDS):
return 'h:mm:ss a';
case stringify(TIME_WITH_SHORT_OFFSET):
return 'h:mm a';
case stringify(TIME_WITH_LONG_OFFSET):
return 'h:mm a';
case stringify(TIME_24_SIMPLE):
return 'HH:mm';
case stringify(TIME_24_WITH_SECONDS):
return 'HH:mm:ss';
case stringify(TIME_24_WITH_SHORT_OFFSET):
return 'HH:mm';
case stringify(TIME_24_WITH_LONG_OFFSET):
return 'HH:mm';
case stringify(DATETIME_SHORT):
return 'M/d/yyyy, h:mm a';
case stringify(DATETIME_MED):
return 'LLL d, yyyy, h:mm a';
case stringify(DATETIME_FULL):
return 'LLLL d, yyyy, h:mm a';
case stringify(DATETIME_HUGE):
return dateTimeHuge;
case stringify(DATETIME_SHORT_WITH_SECONDS):
return 'M/d/yyyy, h:mm:ss a';
case stringify(DATETIME_MED_WITH_SECONDS):
return 'LLL d, yyyy, h:mm:ss a';
case stringify(DATETIME_FULL_WITH_SECONDS):
return 'LLLL d, yyyy, h:mm:ss a';
case stringify(DATETIME_HUGE_WITH_SECONDS):
return 'EEEE, LLLL d, yyyy, h:mm:ss a';
default:
return dateTimeHuge;
}
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
// these aren't really private, but nor are they really useful to document
/**
* @private
*/
var LuxonError = function (_Error) {
inherits(LuxonError, _Error);
function LuxonError() {
classCallCheck(this, LuxonError);
return possibleConstructorReturn(this, _Error.apply(this, arguments));
}
return LuxonError;
}(Error);
/**
* @private
*/
var InvalidDateTimeError = function (_LuxonError) {
inherits(InvalidDateTimeError, _LuxonError);
function InvalidDateTimeError(reason) {
classCallCheck(this, InvalidDateTimeError);
return possibleConstructorReturn(this, _LuxonError.call(this, 'Invalid DateTime: ' + reason));
}
return InvalidDateTimeError;
}(LuxonError);
/**
* @private
*/
var InvalidIntervalError = function (_LuxonError2) {
inherits(InvalidIntervalError, _LuxonError2);
function InvalidIntervalError(reason) {
classCallCheck(this, InvalidIntervalError);
return possibleConstructorReturn(this, _LuxonError2.call(this, 'Invalid Interval: ' + reason));
}
return InvalidIntervalError;
}(LuxonError);
/**
* @private
*/
var InvalidDurationError = function (_LuxonError3) {
inherits(InvalidDurationError, _LuxonError3);
function InvalidDurationError(reason) {
classCallCheck(this, InvalidDurationError);
return possibleConstructorReturn(this, _LuxonError3.call(this, 'Invalid Duration: ' + reason));
}
return InvalidDurationError;
}(LuxonError);
/**
* @private
*/
var ConflictingSpecificationError = function (_LuxonError4) {
inherits(ConflictingSpecificationError, _LuxonError4);
function ConflictingSpecificationError() {
classCallCheck(this, ConflictingSpecificationError);
return possibleConstructorReturn(this, _LuxonError4.apply(this, arguments));
}
return ConflictingSpecificationError;
}(LuxonError);
/**
* @private
*/
var InvalidUnitError = function (_LuxonError5) {
inherits(InvalidUnitError, _LuxonError5);
function InvalidUnitError(unit) {
classCallCheck(this, InvalidUnitError);
return possibleConstructorReturn(this, _LuxonError5.call(this, 'Invalid unit ' + unit));
}
return InvalidUnitError;
}(LuxonError);
/**
* @private
*/
var InvalidArgumentError = function (_LuxonError6) {
inherits(InvalidArgumentError, _LuxonError6);
function InvalidArgumentError() {
classCallCheck(this, InvalidArgumentError);
return possibleConstructorReturn(this, _LuxonError6.apply(this, arguments));
}
return InvalidArgumentError;
}(LuxonError);
/**
* @private
*/
var ZoneIsAbstractError = function (_LuxonError7) {
inherits(ZoneIsAbstractError, _LuxonError7);
function ZoneIsAbstractError() {
classCallCheck(this, ZoneIsAbstractError);
return possibleConstructorReturn(this, _LuxonError7.call(this, 'Zone is an abstract class'));
}
return ZoneIsAbstractError;
}(LuxonError);
/* eslint no-unused-vars: "off" */
/**
* @interface
*/
var Zone = function () {
function Zone() {
classCallCheck(this, Zone);
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
Zone.prototype.offsetName = function offsetName(ts, opts) {
throw new ZoneIsAbstractError();
};
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
Zone.prototype.offset = function offset(ts) {
throw new ZoneIsAbstractError();
};
/**
* Return whether this Zone is equal to another zoner
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
Zone.prototype.equals = function equals(otherZone) {
throw new ZoneIsAbstractError();
};
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
createClass(Zone, [{
key: 'type',
/**
* The type of zone
* @abstract
* @type {string}
*/
get: function get$$1() {
throw new ZoneIsAbstractError();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
}, {
key: 'name',
get: function get$$1() {
throw new ZoneIsAbstractError();
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
}, {
key: 'universal',
get: function get$$1() {
throw new ZoneIsAbstractError();
}
}, {
key: 'isValid',
get: function get$$1() {
throw new ZoneIsAbstractError();
}
}]);
return Zone;
}();
var singleton = null;
var LocalZone = function (_Zone) {
inherits(LocalZone, _Zone);
function LocalZone() {
classCallCheck(this, LocalZone);
return possibleConstructorReturn(this, _Zone.apply(this, arguments));
}
LocalZone.prototype.offsetName = function offsetName(ts, _ref) {
var format = _ref.format,
locale = _ref.locale;
return parseZoneInfo(ts, format, locale);
};
LocalZone.prototype.offset = function offset(ts) {
return -new Date(ts).getTimezoneOffset();
};
LocalZone.prototype.equals = function equals(otherZone) {
return otherZone.type === 'local';
};
createClass(LocalZone, [{
key: 'type',
get: function get$$1() {
return 'local';
}
}, {
key: 'name',
get: function get$$1() {
if (hasIntl()) {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
} else return 'local';
}
}, {
key: 'universal',
get: function get$$1() {
return false;
}
}, {
key: 'isValid',
get: function get$$1() {
return true;
}
}], [{
key: 'instance',
get: function get$$1() {
if (singleton === null) {
singleton = new LocalZone();
}
return singleton;
}
}]);
return LocalZone;
}(Zone);
var dtfCache = {};
function makeDTF(zone) {
if (!dtfCache[zone]) {
dtfCache[zone] = new Intl.DateTimeFormat('en-US', {
hour12: false,
timeZone: zone,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
}
return dtfCache[zone];
}
var typeToPos = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5
};
function hackyOffset(dtf, date) {
var formatted = dtf.format(date).replace(/\u200E/g, ''),
parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted),
fMonth = parsed[1],
fDay = parsed[2],
fYear = parsed[3],
fHour = parsed[4],
fMinute = parsed[5],
fSecond = parsed[6];
return [fYear, fMonth, fDay, fHour, fMinute, fSecond];
}
function partsOffset(dtf, date) {
var formatted = dtf.formatToParts(date),
filled = [];
for (var i = 0; i < formatted.length; i++) {
var _formatted$i = formatted[i],
type = _formatted$i.type,
value = _formatted$i.value,
pos = typeToPos[type];
if (!isUndefined(pos)) {
filled[pos] = parseInt(value, 10);
}
}
return filled;
}
var IANAZone = function (_Zone) {
inherits(IANAZone, _Zone);
IANAZone.isValidSpecifier = function isValidSpecifier(s) {
return s && s.match(/^[a-z_+-]{1,256}\/[a-z_+-]{1,256}(\/[a-z_+-]{1,256})?$/i);
};
IANAZone.isValidZone = function isValidZone(zone) {
try {
new Intl.DateTimeFormat('en-US', { timeZone: zone }).format();
return true;
} catch (e) {
return false;
}
};
// Etc/GMT+8 -> 480
IANAZone.parseGMTOffset = function parseGMTOffset(specifier) {
if (specifier) {
var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i);
if (match) {
return 60 * parseInt(match[1]);
}
}
return null;
};
function IANAZone(name) {
classCallCheck(this, IANAZone);
var _this = possibleConstructorReturn(this, _Zone.call(this));
_this.zoneName = name;
_this.valid = IANAZone.isValidZone(name);
return _this;
}
IANAZone.prototype.offsetName = function offsetName(ts, _ref) {
var format = _ref.format,
locale = _ref.locale;
return parseZoneInfo(ts, format, locale, this.zoneName);
};
IANAZone.prototype.offset = function offset(ts) {
var date = new Date(ts),
dtf = makeDTF(this.zoneName),
_ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date),
fYear = _ref2[0],
fMonth = _ref2[1],
fDay = _ref2[2],
fHour = _ref2[3],
fMinute = _ref2[4],
fSecond = _ref2[5],
asUTC = Date.UTC(fYear, fMonth - 1, fDay, fHour, fMinute, fSecond);
var asTS = date.valueOf();
asTS -= asTS % 1000;
return (asUTC - asTS) / (60 * 1000);
};
IANAZone.prototype.equals = function equals(otherZone) {
return otherZone.type === 'iana' && otherZone.zoneName === this.zoneName;
};
createClass(IANAZone, [{
key: 'type',
get: function get$$1() {
return 'iana';
}
}, {
key: 'name',
get: function get$$1() {
return this.zoneName;
}
}, {
key: 'universal',
get: function get$$1() {
return false;
}
}, {
key: 'isValid',
get: function get$$1() {
return this.valid;
}
}]);
return IANAZone;
}(Zone);
var singleton$1 = null;
function hoursMinutesOffset(z) {
var hours = Math.trunc(z.fixed / 60),
minutes = Math.abs(z.fixed % 60),
sign = hours > 0 ? '+' : '-',
base = sign + Math.abs(hours);
return minutes > 0 ? base + ':' + padStart(minutes, 2) : base;
}
var FixedOffsetZone = function (_Zone) {
inherits(FixedOffsetZone, _Zone);
FixedOffsetZone.instance = function instance(offset) {
return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
};
FixedOffsetZone.parseSpecifier = function parseSpecifier(s) {
if (s) {
var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
if (r) {
return new FixedOffsetZone(signedOffset(r[1], r[2]));
}
}
return null;
};
createClass(FixedOffsetZone, null, [{
key: 'utcInstance',
get: function get$$1() {
if (singleton$1 === null) {
singleton$1 = new FixedOffsetZone(0);
}
return singleton$1;
}
}]);
function FixedOffsetZone(offset) {
classCallCheck(this, FixedOffsetZone);
var _this = possibleConstructorReturn(this, _Zone.call(this));
_this.fixed = offset;
return _this;
}
FixedOffsetZone.prototype.offsetName = function offsetName() {
return this.name;
};
FixedOffsetZone.prototype.offset = function offset() {
return this.fixed;
};
FixedOffsetZone.prototype.equals = function equals(otherZone) {
return otherZone.type === 'fixed' && otherZone.fixed === this.fixed;
};
createClass(FixedOffsetZone, [{
key: 'type',
get: function get$$1() {
return 'fixed';
}
}, {
key: 'name',
get: function get$$1() {
return this.fixed === 0 ? 'UTC' : 'UTC' + hoursMinutesOffset(this);
}
}, {
key: 'universal',
get: function get$$1() {
return true;
}
}, {
key: 'isValid',
get: function get$$1() {
return true;
}
}]);
return FixedOffsetZone;
}(Zone);
var singleton$2 = null;
var InvalidZone = function (_Zone) {
inherits(InvalidZone, _Zone);
function InvalidZone() {
classCallCheck(this, InvalidZone);
return possibleConstructorReturn(this, _Zone.apply(this, arguments));
}
InvalidZone.prototype.offsetName = function offsetName() {
return null;
};
InvalidZone.prototype.offset = function offset() {
return NaN;
};
InvalidZone.prototype.equals = function equals() {
return false;
};
createClass(InvalidZone, [{
key: 'type',
get: function get$$1() {
return 'invalid';
}
}, {
key: 'name',
get: function get$$1() {
return null;
}
}, {
key: 'universal',
get: function get$$1() {
return false;
}
}, {
key: 'isValid',
get: function get$$1() {
return false;
}
}], [{
key: 'instance',
get: function get$$1() {
if (singleton$2 === null) {
singleton$2 = new InvalidZone();
}
return singleton$2;
}
}]);
return InvalidZone;
}(Zone);
/**
* @private
*/
function normalizeZone(input, defaultZone) {
var offset = void 0;
if (isUndefined(input) || input === null) {
return defaultZone;
} else if (input instanceof Zone) {
return input;
} else if (isString(input)) {
var lowered = input.toLowerCase();
if (lowered === 'local') return LocalZone.instance;else if (lowered === 'utc' || lowered === 'gmt') return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) {
// handle Etc/GMT-4, which V8 chokes on
return FixedOffsetZone.instance(offset);
} else if (IANAZone.isValidSpecifier(lowered)) return new IANAZone(input);else return FixedOffsetZone.parseSpecifier(lowered) || InvalidZone.instance;
} else if (isNumber(input)) {
return FixedOffsetZone.instance(input);
} else if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && input.offset) {
// This is dumb, but the instanceof check above doesn't seem to really work
// so we're duck checking it
return input;
} else {
return InvalidZone.instance;
}
}
var now = function now() {
return new Date().valueOf();
},
defaultZone = null,
// not setting this directly to LocalZone.instance bc loading order issues
defaultLocale = null,
defaultNumberingSystem = null,
defaultOutputCalendar = null,
throwOnInvalid = false;
/**
* Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
*/
var Settings = function () {
function Settings() {
classCallCheck(this, Settings);
}
/**
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
* @return {void}
*/
Settings.resetCaches = function resetCaches() {
Locale.resetCache();
};
createClass(Settings, null, [{
key: 'now',
/**
* Get the callback for returning the current timestamp.
* @type {function}
*/
get: function get$$1() {
return now;
}
/**
* Set the callback for returning the current timestamp.
* @type {function}
*/
,
set: function set$$1(n) {
now = n;
}
/**
* Get the default time zone to create DateTimes in.
* @type {string}
*/
}, {
key: 'defaultZoneName',
get: function get$$1() {
return (defaultZone || LocalZone.instance).name;
}
/**
* Set the default time zone to create DateTimes in. Does not affect existing instances.
* @type {string}
*/
,
set: function set$$1(z) {
if (!z) {
defaultZone = null;
} else {
defaultZone = normalizeZone(z);
}
}
/**
* Get the default time zone object to create DateTimes in. Does not affect existing instances.
* @type {Zone}
*/
}, {
key: 'defaultZone',
get: function get$$1() {
return defaultZone || LocalZone.instance;
}
/**
* Get the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
}, {
key: 'defaultLocale',
get: function get$$1() {
return defaultLocale;
}
/**
* Set the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
,
set: function set$$1(locale) {
defaultLocale = locale;
}
/**
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
}, {
key: 'defaultNumberingSystem',
get: function get$$1() {
return defaultNumberingSystem;
}
/**
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
,
set: function set$$1(numberingSystem) {
defaultNumberingSystem = numberingSystem;
}
/**
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
}, {
key: 'defaultOutputCalendar',
get: function get$$1() {
return defaultOutputCalendar;
}
/**
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
,
set: function set$$1(outputCalendar) {
defaultOutputCalendar = outputCalendar;
}
/**
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
}, {
key: 'throwOnInvalid',
get: function get$$1() {
return throwOnInvalid;
}
/**
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
,
set: function set$$1(t) {
throwOnInvalid = t;
}
}]);
return Settings;
}();
function stringifyTokens(splits, tokenToString) {
var s = '';
for (var _iterator = splits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var token = _ref;
if (token.literal) {
s += token.val;
} else {
s += tokenToString(token.val);
}
}
return s;
}
var tokenToObject = {
D: DATE_SHORT,
DD: DATE_MED,
DDD: DATE_FULL,
DDDD: DATE_HUGE,
t: TIME_SIMPLE,
tt: TIME_WITH_SECONDS,
ttt: TIME_WITH_SHORT_OFFSET,
tttt: TIME_WITH_LONG_OFFSET,
T: TIME_24_SIMPLE,
TT: TIME_24_WITH_SECONDS,
TTT: TIME_24_WITH_SHORT_OFFSET,
TTTT: TIME_24_WITH_LONG_OFFSET,
f: DATETIME_SHORT,
ff: DATETIME_MED,
fff: DATETIME_FULL,
ffff: DATETIME_HUGE,
F: DATETIME_SHORT_WITH_SECONDS,
FF: DATETIME_MED_WITH_SECONDS,
FFF: DATETIME_FULL_WITH_SECONDS,
FFFF: DATETIME_HUGE_WITH_SECONDS
};
/**
* @private
*/
var Formatter = function () {
Formatter.create = function create(locale) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var formatOpts = Object.assign({}, { round: true }, opts);
return new Formatter(locale, formatOpts);
};
Formatter.parseFormat = function parseFormat(fmt) {
var current = null,
currentFull = '',
bracketed = false;
var splits = [];
for (var i = 0; i < fmt.length; i++) {
var c = fmt.charAt(i);
if (c === "'") {
if (currentFull.length > 0) {
splits.push({ literal: bracketed, val: currentFull });
}
current = null;
currentFull = '';
bracketed = !bracketed;
} else if (bracketed) {
currentFull += c;
} else if (c === current) {
currentFull += c;
} else {
if (currentFull.length > 0) {
splits.push({ literal: false, val: currentFull });
}
currentFull = c;
current = c;
}
}
if (currentFull.length > 0) {
splits.push({ literal: bracketed, val: currentFull });
}
return splits;
};
function Formatter(locale, formatOpts) {
classCallCheck(this, Formatter);
this.opts = formatOpts;
this.loc = locale;
this.systemLoc = null;
}
Formatter.prototype.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) {
if (this.systemLoc === null) {
this.systemLoc = this.loc.redefaultToSystem();
}
var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));
return df.format();
};
Formatter.prototype.formatDateTime = function formatDateTime(dt) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
return df.format();
};
Formatter.prototype.formatDateTimeParts = function formatDateTimeParts(dt) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
return df.formatToParts();
};
Formatter.prototype.resolvedOptions = function resolvedOptions(dt) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
return df.resolvedOptions();
};
Formatter.prototype.num = function num(n) {
var p = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// we get some perf out of doing this here, annoyingly
if (this.opts.forceSimple) {
return padStart(n, p);
}
var opts = Object.assign({}, this.opts);
if (p > 0) {
opts.padTo = p;
}
return this.loc.numberFormatter(opts).format(n);
};
Formatter.prototype.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) {
var _this = this;
var knownEnglish = this.loc.listingMode() === 'en';
var string = function string(opts, extract) {
return _this.loc.extract(dt, opts, extract);
},
formatOffset = function formatOffset(opts) {
if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
return 'Z';
}
var hours = Math.trunc(dt.offset / 60),
minutes = Math.abs(dt.offset % 60),
sign = hours >= 0 ? '+' : '-',
base = '' + sign + Math.abs(hours);
switch (opts.format) {
case 'short':
return '' + sign + _this.num(Math.abs(hours), 2) + ':' + _this.num(minutes, 2);
case 'narrow':
return minutes > 0 ? base + ':' + minutes : base;
case 'techie':
return '' + sign + _this.num(Math.abs(hours), 2) + _this.num(minutes, 2);
default:
throw new RangeError('Value format ' + opts.format + ' is out of range for property format');
}
},
meridiem = function meridiem() {
return knownEnglish ? meridiemForDateTime(dt) : string({ hour: 'numeric', hour12: true }, 'dayperiod');
},
month = function month(length, standalone) {
return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: 'numeric' }, 'month');
},
weekday = function weekday(length, standalone) {
return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { weekday: length } : { weekday: length, month: 'long', day: 'numeric' }, 'weekday');
},
maybeMacro = function maybeMacro(token) {
var macro = tokenToObject[token];
if (macro) {
return _this.formatWithSystemDefault(dt, macro);
} else {
return token;
}
},
era = function era(length) {
return knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, 'era');
},
tokenToString = function tokenToString(token) {
var outputCal = _this.loc.outputCalendar;
// Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles
switch (token) {
// ms
case 'S':
return _this.num(dt.millisecond);
case 'u':
// falls through
case 'SSS':
return _this.num(dt.millisecond, 3);
// seconds
case 's':
return _this.num(dt.second);
case 'ss':
return _this.num(dt.second, 2);
// minutes
case 'm':
return _this.num(dt.minute);
case 'mm':
return _this.num(dt.minute, 2);
// hours
case 'h':
return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
case 'hh':
return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
case 'H':
return _this.num(dt.hour);
case 'HH':
return _this.num(dt.hour, 2);
// offset
case 'Z':
// like +6
return formatOffset({ format: 'narrow', allowZ: _this.opts.allowZ });
case 'ZZ':
// like +06:00
return formatOffset({ format: 'short', allowZ: _this.opts.allowZ });
case 'ZZZ':
// like +0600
return formatOffset({ format: 'techie', allowZ: false });
case 'ZZZZ':
// like EST
return dt.offsetNameShort;
case 'ZZZZZ':
// like Eastern Standard Time
return dt.offsetNameLong;
// zone
case 'z':
// like America/New_York
return dt.zoneName;
// meridiems
case 'a':
return meridiem();
// dates
case 'd':
return outputCal ? string({ day: 'numeric' }, 'day') : _this.num(dt.day);
case 'dd':
return outputCal ? string({ day: '2-digit' }, 'day') : _this.num(dt.day, 2);
// weekdays - standalone
case 'c':
// like 1
return _this.num(dt.weekday);
case 'ccc':
// like 'Tues'
return weekday('short', true);
case 'cccc':
// like 'Tuesday'
return weekday('long', true);
case 'ccccc':
// like 'T'
return weekday('narrow', true);
// weekdays - format
case 'E':
// like 1
return _this.num(dt.weekday);
case 'EEE':
// like 'Tues'
return weekday('short', false);
case 'EEEE':
// like 'Tuesday'
return weekday('long', false);
case 'EEEEE':
// like 'T'
return weekday('narrow', false);
// months - standalone
case 'L':
// like 1
return outputCal ? string({ month: 'numeric', day: 'numeric' }, 'month') : _this.num(dt.month);
case 'LL':
// like 01, doesn't seem to work
return outputCal ? string({ month: '2-digit', day: 'numeric' }, 'month') : _this.num(dt.month, 2);
case 'LLL':
// like Jan
return month('short', true);
case 'LLLL':
// like January
return month('long', true);
case 'LLLLL':
// like J
return month('narrow', true);
// months - format
case 'M':
// like 1
return outputCal ? string({ month: 'numeric' }, 'month') : _this.num(dt.month);
case 'MM':
// like 01
return outputCal ? string({ month: '2-digit' }, 'month') : _this.num(dt.month, 2);
case 'MMM':
// like Jan
return month('short', false);
case 'MMMM':
// like January
return month('long', false);
case 'MMMMM':
// like J
return month('narrow', false);
// years
case 'y':
// like 2014
return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year);
case 'yy':
// like 14
return outputCal ? string({ year: '2-digit' }, 'year') : _this.num(dt.year.toString().slice(-2), 2);
case 'yyyy':
// like 0012
return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year, 4);
case 'yyyyyy':
// like 000012
return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year, 6);
// eras
case 'G':
// like AD
return era('short');
case 'GG':
// like Anno Domini
return era('long');
case 'GGGGG':
return era('narrow');
case 'kk':
return _this.num(dt.weekYear.toString().slice(-2), 2);
case 'kkkk':
return _this.num(dt.weekYear, 4);
case 'W':
return _this.num(dt.weekNumber);
case 'WW':
return _this.num(dt.weekNumber, 2);
case 'o':
return _this.num(dt.ordinal);
case 'ooo':
return _this.num(dt.ordinal, 3);
case 'q':
// like 1
return _this.num(dt.quarter);
case 'qq':
// like 01
return _this.num(dt.quarter, 2);
default:
return maybeMacro(token);
}
};
return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
};
Formatter.prototype.formatDurationFromString = function formatDurationFromString(dur, fmt) {
var _this2 = this;
var tokenToField = function tokenToField(token) {
switch (token[0]) {
case 'S':
return 'millisecond';
case 's':
return 'second';
case 'm':
return 'minute';
case 'h':
return 'hour';
case 'd':
return 'day';
case 'M':
return 'month';
case 'y':
return 'year';
default:
return null;
}
},
tokenToString = function tokenToString(lildur) {
return function (token) {
var mapped = tokenToField(token);
if (mapped) {
return _this2.num(lildur.get(mapped), token.length);
} else {
return token;
}
};
},
tokens = Formatter.parseFormat(fmt),
realTokens = tokens.reduce(function (found, _ref2) {
var literal = _ref2.literal,
val = _ref2.val;
return literal ? found : found.concat(val);
}, []),
collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) {
return t;
}));
return stringifyTokens(tokens, tokenToString(collapsed));
};
return Formatter;
}();
var sysLocaleCache = null;
function systemLocale() {
if (sysLocaleCache) {
return sysLocaleCache;
} else if (hasIntl()) {
var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;
// node sometimes defaults to "und". Override that because that is dumb
sysLocaleCache = computedSys === 'und' ? 'en-US' : computedSys;
return sysLocaleCache;
} else {
sysLocaleCache = 'en-US';
return sysLocaleCache;
}
}
function intlConfigString(locale, numberingSystem, outputCalendar) {
if (hasIntl()) {
locale = Array.isArray(locale) ? locale : [locale];
if (outputCalendar || numberingSystem) {
locale = locale.map(function (l) {
l += '-u';
if (outputCalendar) {
l += '-ca-' + outputCalendar;
}
if (numberingSystem) {
l += '-nu-' + numberingSystem;
}
return l;
});
}
return locale;
} else {
return [];
}
}
function mapMonths(f) {
var ms = [];
for (var i = 1; i <= 12; i++) {
var dt = DateTime.utc(2016, i, 1);
ms.push(f(dt));
}
return ms;
}
function mapWeekdays(f) {
var ms = [];
for (var i = 1; i <= 7; i++) {
var dt = DateTime.utc(2016, 11, 13 + i);
ms.push(f(dt));
}
return ms;
}
function listStuff(loc, length, defaultOK, englishFn, intlFn) {
var mode = loc.listingMode(defaultOK);
if (mode === 'error') {
return null;
} else if (mode === 'en') {
return englishFn(length);
} else {
return intlFn(length);
}
}
function supportsFastNumbers(loc) {
if (loc.numberingSystem && loc.numberingSystem !== 'latn') {
return false;
} else {
return loc.numberingSystem === 'latn' || !loc.locale || loc.locale.startsWith('en') || hasIntl() && Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === 'latn';
}
}
/**
* @private
*/
var SimpleNumberFormatter = function () {
function SimpleNumberFormatter(opts) {
classCallCheck(this, SimpleNumberFormatter);
this.padTo = opts.padTo || 0;
this.round = opts.round || false;
this.floor = opts.floor || false;
}
SimpleNumberFormatter.prototype.format = function format(i) {
// to match the browser's numberformatter defaults
var fixed = this.floor ? Math.floor(i) : roundTo(i, this.round ? 0 : 3);
return padStart(fixed, this.padTo);
};
return SimpleNumberFormatter;
}();
var IntlNumberFormatter = function () {
function IntlNumberFormatter(intl, opts) {
classCallCheck(this, IntlNumberFormatter);
var intlOpts = { useGrouping: false };
if (opts.padTo > 0) {
intlOpts.minimumIntegerDigits = opts.padTo;
}
if (opts.round) {
intlOpts.maximumFractionDigits = 0;
}
this.floor = opts.floor;
this.intl = new Intl.NumberFormat(intl, intlOpts);
}
IntlNumberFormatter.prototype.format = function format(i) {
var fixed = this.floor ? Math.floor(i) : i;
return this.intl.format(fixed);
};
return IntlNumberFormatter;
}();
/**
* @private
*/
var PolyDateFormatter = function () {
function PolyDateFormatter(dt, intl, opts) {
classCallCheck(this, PolyDateFormatter);
this.opts = opts;
this.hasIntl = hasIntl();
var z = void 0;
if (dt.zone.universal && this.hasIntl) {
// Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,
// See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.
// So we have to make do. Two cases:
// 1. The format options tell us to show the zone. We can't do that, so the best
// we can do is format the date in UTC.
// 2. The format options don't tell us to show the zone. Then we can adjust them
// the time and tell the formatter to show it to us in UTC, so that the time is right
// and the bad zone doesn't show up.
// We can clean all this up when Chrome fixes this.
z = 'UTC';
if (opts.timeZoneName) {
this.dt = dt;
} else {
this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
}
} else if (dt.zone.type === 'local') {
this.dt = dt;
} else {
this.dt = dt;
z = dt.zone.name;
}
if (this.hasIntl) {
var realIntlOpts = Object.assign({}, this.opts);
if (z) {
realIntlOpts.timeZone = z;
}
this.dtf = new Intl.DateTimeFormat(intl, realIntlOpts);
}
}
PolyDateFormatter.prototype.format = function format() {
if (this.hasIntl) {
return this.dtf.format(this.dt.toJSDate());
} else {
var tokenFormat = formatString(this.opts),
loc = Locale.create('en-US');
return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);
}
};
PolyDateFormatter.prototype.formatToParts = function formatToParts() {
if (this.hasIntl && hasFormatToParts()) {
return this.dtf.formatToParts(this.dt.toJSDate());
} else {
// This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings
// and IMO it's too weird to have an uncanny valley like that
return [];
}
};
PolyDateFormatter.prototype.resolvedOptions = function resolvedOptions() {
if (this.hasIntl) {
return this.dtf.resolvedOptions();
} else {
return {
locale: 'en-US',
numberingSystem: 'latn',
outputCalendar: 'gregory'
};
}
};
return PolyDateFormatter;
}();
/**
* @private
*/
var Locale = function () {
Locale.fromOpts = function fromOpts(opts) {
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
};
Locale.create = function create(locale, numberingSystem, outputCalendar) {
var defaultToEN = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var specifiedLocale = locale || Settings.defaultLocale,
// the system locale is useful for human readable strings but annoying for parsing/formatting known formats
localeR = specifiedLocale || (defaultToEN ? 'en-US' : systemLocale()),
numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,
outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
};
Locale.resetCache = function resetCache() {
sysLocaleCache = null;
};
Locale.fromObject = function fromObject() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
locale = _ref.locale,
numberingSystem = _ref.numberingSystem,
outputCalendar = _ref.outputCalendar;
return Locale.create(locale, numberingSystem, outputCalendar);
};
function Locale(locale, numbering, outputCalendar, specifiedLocale) {
classCallC