774 lines
26 KiB
JavaScript
774 lines
26 KiB
JavaScript
(() => {
|
|
var _window$dateFns;function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _defineProperty(e, r, t) {return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : i + "";}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);} //#region dist/date-fns/locale/zh-CN/_lib/formatDistance.js
|
|
var formatDistanceLocale = {
|
|
lessThanXSeconds: {
|
|
one: "不到 1 秒",
|
|
other: "不到 {{count}} 秒"
|
|
},
|
|
xSeconds: {
|
|
one: "1 秒",
|
|
other: "{{count}} 秒"
|
|
},
|
|
halfAMinute: "半分钟",
|
|
lessThanXMinutes: {
|
|
one: "不到 1 分钟",
|
|
other: "不到 {{count}} 分钟"
|
|
},
|
|
xMinutes: {
|
|
one: "1 分钟",
|
|
other: "{{count}} 分钟"
|
|
},
|
|
xHours: {
|
|
one: "1 小时",
|
|
other: "{{count}} 小时"
|
|
},
|
|
aboutXHours: {
|
|
one: "大约 1 小时",
|
|
other: "大约 {{count}} 小时"
|
|
},
|
|
xDays: {
|
|
one: "1 天",
|
|
other: "{{count}} 天"
|
|
},
|
|
aboutXWeeks: {
|
|
one: "大约 1 个星期",
|
|
other: "大约 {{count}} 个星期"
|
|
},
|
|
xWeeks: {
|
|
one: "1 个星期",
|
|
other: "{{count}} 个星期"
|
|
},
|
|
aboutXMonths: {
|
|
one: "大约 1 个月",
|
|
other: "大约 {{count}} 个月"
|
|
},
|
|
xMonths: {
|
|
one: "1 个月",
|
|
other: "{{count}} 个月"
|
|
},
|
|
aboutXYears: {
|
|
one: "大约 1 年",
|
|
other: "大约 {{count}} 年"
|
|
},
|
|
xYears: {
|
|
one: "1 年",
|
|
other: "{{count}} 年"
|
|
},
|
|
overXYears: {
|
|
one: "超过 1 年",
|
|
other: "超过 {{count}} 年"
|
|
},
|
|
almostXYears: {
|
|
one: "将近 1 年",
|
|
other: "将近 {{count}} 年"
|
|
}
|
|
};
|
|
var formatDistance = function formatDistance(token, count, options) {
|
|
var result;
|
|
var tokenValue = formatDistanceLocale[token];
|
|
if (typeof tokenValue === "string") result = tokenValue;else
|
|
if (count === 1) result = tokenValue.one;else
|
|
result = tokenValue.other.replace("{{count}}", String(count));
|
|
if (options !== null && options !== void 0 && options.addSuffix) if (options.comparison && options.comparison > 0) return result + "内";else
|
|
return result + "前";
|
|
return result;
|
|
};
|
|
//#endregion
|
|
//#region dist/date-fns/locale/_lib/buildFormatLongFn.js
|
|
function buildFormatLongFn(args) {
|
|
return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
return args.formats[width] || args.formats[args.defaultWidth];
|
|
};
|
|
}
|
|
var formatLong = {
|
|
date: buildFormatLongFn({
|
|
formats: {
|
|
full: "y'年'M'月'd'日' EEEE",
|
|
long: "y'年'M'月'd'日'",
|
|
medium: "yyyy-MM-dd",
|
|
short: "yy-MM-dd"
|
|
},
|
|
defaultWidth: "full"
|
|
}),
|
|
time: buildFormatLongFn({
|
|
formats: {
|
|
full: "zzzz a h:mm:ss",
|
|
long: "z a h:mm:ss",
|
|
medium: "a h:mm:ss",
|
|
short: "a h:mm"
|
|
},
|
|
defaultWidth: "full"
|
|
}),
|
|
dateTime: buildFormatLongFn({
|
|
formats: {
|
|
full: "{{date}} {{time}}",
|
|
long: "{{date}} {{time}}",
|
|
medium: "{{date}} {{time}}",
|
|
short: "{{date}} {{time}}"
|
|
},
|
|
defaultWidth: "full"
|
|
})
|
|
};
|
|
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
/**
|
|
* @constant
|
|
* @name constructFromSymbol
|
|
* @summary Symbol enabling Date extensions to inherit properties from the reference date.
|
|
*
|
|
* The symbol is used to enable the `constructFrom` function to construct a date
|
|
* using a reference date and a value. It allows to transfer extra properties
|
|
* from the reference date to the new date. It's useful for extensions like
|
|
* [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
|
|
* a constructor argument.
|
|
*/
|
|
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
//#endregion
|
|
//#region dist/date-fns/constructFrom.js
|
|
/**
|
|
* @name constructFrom
|
|
* @category Generic Helpers
|
|
* @summary Constructs a date using the reference date and the value
|
|
*
|
|
* @description
|
|
* The function constructs a new date using the constructor from the reference
|
|
* date and the given value. It helps to build generic functions that accept
|
|
* date extensions.
|
|
*
|
|
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
*
|
|
* Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
|
|
* enabling to transfer extra properties from the reference date to the new date.
|
|
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
* that accept a time zone as a constructor argument.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The reference date to take constructor from
|
|
* @param value - The value to create the date
|
|
*
|
|
* @returns Date initialized using the given date and value
|
|
*
|
|
* @example
|
|
* import { constructFrom } from "./constructFrom/date-fns";
|
|
*
|
|
* // A function that clones a date preserving the original type
|
|
* function cloneDate<DateType extends Date>(date: DateType): DateType {
|
|
* return constructFrom(
|
|
* date, // Use constructor from the given date
|
|
* date.getTime() // Use the date value to create a new date
|
|
* );
|
|
* }
|
|
*/
|
|
function constructFrom(date, value) {
|
|
if (typeof date === "function") return date(value);
|
|
if (date && _typeof(date) === "object" && constructFromSymbol in date) return date[constructFromSymbol](value);
|
|
if (date instanceof Date) return new date.constructor(value);
|
|
return new Date(value);
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/_lib/normalizeDates.js
|
|
function normalizeDates(context) {for (var _len = arguments.length, dates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {dates[_key - 1] = arguments[_key];}
|
|
var normalize = constructFrom.bind(null, context || dates.find(function (date) {return _typeof(date) === "object";}));
|
|
return dates.map(normalize);
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/_lib/defaultOptions.js
|
|
var defaultOptions = {};
|
|
function getDefaultOptions() {
|
|
return defaultOptions;
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/toDate.js
|
|
/**
|
|
* @name toDate
|
|
* @category Common Helpers
|
|
* @summary Convert the given argument to an instance of Date.
|
|
*
|
|
* @description
|
|
* Convert the given argument to an instance of Date.
|
|
*
|
|
* If the argument is an instance of Date, the function returns its clone.
|
|
*
|
|
* If the argument is a number, it is treated as a timestamp.
|
|
*
|
|
* If the argument is none of the above, the function returns Invalid Date.
|
|
*
|
|
* Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
|
|
* enabling to transfer extra properties from the reference date to the new date.
|
|
* It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
|
|
* that accept a time zone as a constructor argument.
|
|
*
|
|
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
*
|
|
* @param argument - The value to convert
|
|
*
|
|
* @returns The parsed date in the local time zone
|
|
*
|
|
* @example
|
|
* // Clone the date:
|
|
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
* //=> Tue Feb 11 2014 11:30:30
|
|
*
|
|
* @example
|
|
* // Convert the timestamp to date:
|
|
* const result = toDate(1392098430000)
|
|
* //=> Tue Feb 11 2014 11:30:30
|
|
*/
|
|
function toDate(argument, context) {
|
|
return constructFrom(context || argument, argument);
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/startOfWeek.js
|
|
/**
|
|
* The {@link startOfWeek} function options.
|
|
*/
|
|
/**
|
|
* @name startOfWeek
|
|
* @category Week Helpers
|
|
* @summary Return the start of a week for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a week for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
*
|
|
* @param date - The original date
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The start of a week
|
|
*
|
|
* @example
|
|
* // The start of a week for 2 September 2014 11:55:00:
|
|
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
* //=> Sun Aug 31 2014 00:00:00
|
|
*
|
|
* @example
|
|
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
* //=> Mon Sep 01 2014 00:00:00
|
|
*/
|
|
function startOfWeek(date, options) {var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _defaultOptions$local;
|
|
var defaultOptions = getDefaultOptions();
|
|
var weekStartsOn = (_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 || (_options$locale = options.locale) === null || _options$locale === void 0 || (_options$locale = _options$locale.options) === null || _options$locale === void 0 ? void 0 : _options$locale.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 || (_defaultOptions$local = _defaultOptions$local.options) === null || _defaultOptions$local === void 0 ? void 0 : _defaultOptions$local.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0;
|
|
var _date = toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
|
var day = _date.getDay();
|
|
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
_date.setDate(_date.getDate() - diff);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/isSameWeek.js
|
|
/**
|
|
* The {@link isSameWeek} function options.
|
|
*/
|
|
/**
|
|
* @name isSameWeek
|
|
* @category Week Helpers
|
|
* @summary Are the given dates in the same week (and month and year)?
|
|
*
|
|
* @description
|
|
* Are the given dates in the same week (and month and year)?
|
|
*
|
|
* @param laterDate - The first date to check
|
|
* @param earlierDate - The second date to check
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The dates are in the same week (and month and year)
|
|
*
|
|
* @example
|
|
* // Are 31 August 2014 and 4 September 2014 in the same week?
|
|
* const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
|
|
* //=> true
|
|
*
|
|
* @example
|
|
* // If week starts with Monday,
|
|
* // are 31 August 2014 and 4 September 2014 in the same week?
|
|
* const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
|
|
* weekStartsOn: 1
|
|
* })
|
|
* //=> false
|
|
*
|
|
* @example
|
|
* // Are 1 January 2014 and 1 January 2015 in the same week?
|
|
* const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
|
|
* //=> false
|
|
*/
|
|
function isSameWeek(laterDate, earlierDate, options) {
|
|
var _normalizeDates = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates2 = _slicedToArray(_normalizeDates, 2),laterDate_ = _normalizeDates2[0],earlierDate_ = _normalizeDates2[1];
|
|
return +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options);
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/locale/zh-CN/_lib/formatRelative.js
|
|
function checkWeek(date, baseDate, options) {
|
|
var baseFormat = "eeee p";
|
|
if (isSameWeek(date, baseDate, options)) return baseFormat;else
|
|
if (date.getTime() > baseDate.getTime()) return "'下个'eeee p";
|
|
return "'上个'eeee p";
|
|
}
|
|
var formatRelativeLocale = {
|
|
lastWeek: checkWeek,
|
|
yesterday: "'昨天' p",
|
|
today: "'今天' p",
|
|
tomorrow: "'明天' p",
|
|
nextWeek: checkWeek,
|
|
other: "PP p"
|
|
};
|
|
var formatRelative = function formatRelative(token, date, baseDate, options) {
|
|
var format = formatRelativeLocale[token];
|
|
if (typeof format === "function") return format(date, baseDate, options);
|
|
return format;
|
|
};
|
|
//#endregion
|
|
//#region dist/date-fns/locale/_lib/buildLocalizeFn.js
|
|
/**
|
|
* The localize function argument callback which allows to convert raw value to
|
|
* the actual type.
|
|
*
|
|
* @param value - The value to convert
|
|
*
|
|
* @returns The converted value
|
|
*/
|
|
/**
|
|
* The map of localized values for each width.
|
|
*/
|
|
/**
|
|
* The index type of the locale unit value. It types conversion of units of
|
|
* values that don't start at 0 (i.e. quarters).
|
|
*/
|
|
/**
|
|
* Converts the unit value to the tuple of values.
|
|
*/
|
|
/**
|
|
* The tuple of localized era values. The first element represents BC,
|
|
* the second element represents AD.
|
|
*/
|
|
/**
|
|
* The tuple of localized quarter values. The first element represents Q1.
|
|
*/
|
|
/**
|
|
* The tuple of localized day values. The first element represents Sunday.
|
|
*/
|
|
/**
|
|
* The tuple of localized month values. The first element represents January.
|
|
*/
|
|
function buildLocalizeFn(args) {
|
|
return function (value, options) {
|
|
var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
|
|
var valuesArray;
|
|
if (context === "formatting" && args.formattingValues) {
|
|
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
} else {
|
|
var _defaultWidth = args.defaultWidth;
|
|
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
}
|
|
var index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
return valuesArray[index];
|
|
};
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/locale/zh-CN/_lib/localize.js
|
|
var eraValues = {
|
|
narrow: ["前", "公元"],
|
|
abbreviated: ["前", "公元"],
|
|
wide: ["公元前", "公元"]
|
|
};
|
|
var quarterValues = {
|
|
narrow: [
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4"],
|
|
|
|
abbreviated: [
|
|
"第一季",
|
|
"第二季",
|
|
"第三季",
|
|
"第四季"],
|
|
|
|
wide: [
|
|
"第一季度",
|
|
"第二季度",
|
|
"第三季度",
|
|
"第四季度"]
|
|
|
|
};
|
|
var monthValues = {
|
|
narrow: [
|
|
"一",
|
|
"二",
|
|
"三",
|
|
"四",
|
|
"五",
|
|
"六",
|
|
"七",
|
|
"八",
|
|
"九",
|
|
"十",
|
|
"十一",
|
|
"十二"],
|
|
|
|
abbreviated: [
|
|
"1月",
|
|
"2月",
|
|
"3月",
|
|
"4月",
|
|
"5月",
|
|
"6月",
|
|
"7月",
|
|
"8月",
|
|
"9月",
|
|
"10月",
|
|
"11月",
|
|
"12月"],
|
|
|
|
wide: [
|
|
"一月",
|
|
"二月",
|
|
"三月",
|
|
"四月",
|
|
"五月",
|
|
"六月",
|
|
"七月",
|
|
"八月",
|
|
"九月",
|
|
"十月",
|
|
"十一月",
|
|
"十二月"]
|
|
|
|
};
|
|
var dayValues = {
|
|
narrow: [
|
|
"日",
|
|
"一",
|
|
"二",
|
|
"三",
|
|
"四",
|
|
"五",
|
|
"六"],
|
|
|
|
short: [
|
|
"日",
|
|
"一",
|
|
"二",
|
|
"三",
|
|
"四",
|
|
"五",
|
|
"六"],
|
|
|
|
abbreviated: [
|
|
"周日",
|
|
"周一",
|
|
"周二",
|
|
"周三",
|
|
"周四",
|
|
"周五",
|
|
"周六"],
|
|
|
|
wide: [
|
|
"星期日",
|
|
"星期一",
|
|
"星期二",
|
|
"星期三",
|
|
"星期四",
|
|
"星期五",
|
|
"星期六"]
|
|
|
|
};
|
|
var dayPeriodValues = {
|
|
narrow: {
|
|
am: "上",
|
|
pm: "下",
|
|
midnight: "凌晨",
|
|
noon: "午",
|
|
morning: "早",
|
|
afternoon: "下午",
|
|
evening: "晚",
|
|
night: "夜"
|
|
},
|
|
abbreviated: {
|
|
am: "上午",
|
|
pm: "下午",
|
|
midnight: "凌晨",
|
|
noon: "中午",
|
|
morning: "早晨",
|
|
afternoon: "中午",
|
|
evening: "晚上",
|
|
night: "夜间"
|
|
},
|
|
wide: {
|
|
am: "上午",
|
|
pm: "下午",
|
|
midnight: "凌晨",
|
|
noon: "中午",
|
|
morning: "早晨",
|
|
afternoon: "中午",
|
|
evening: "晚上",
|
|
night: "夜间"
|
|
}
|
|
};
|
|
var formattingDayPeriodValues = {
|
|
narrow: {
|
|
am: "上",
|
|
pm: "下",
|
|
midnight: "凌晨",
|
|
noon: "午",
|
|
morning: "早",
|
|
afternoon: "下午",
|
|
evening: "晚",
|
|
night: "夜"
|
|
},
|
|
abbreviated: {
|
|
am: "上午",
|
|
pm: "下午",
|
|
midnight: "凌晨",
|
|
noon: "中午",
|
|
morning: "早晨",
|
|
afternoon: "中午",
|
|
evening: "晚上",
|
|
night: "夜间"
|
|
},
|
|
wide: {
|
|
am: "上午",
|
|
pm: "下午",
|
|
midnight: "凌晨",
|
|
noon: "中午",
|
|
morning: "早晨",
|
|
afternoon: "中午",
|
|
evening: "晚上",
|
|
night: "夜间"
|
|
}
|
|
};
|
|
var ordinalNumber = function ordinalNumber(dirtyNumber, options) {
|
|
var number = Number(dirtyNumber);
|
|
switch (options === null || options === void 0 ? void 0 : options.unit) {
|
|
case "date":return number.toString() + "日";
|
|
case "hour":return number.toString() + "时";
|
|
case "minute":return number.toString() + "分";
|
|
case "second":return number.toString() + "秒";
|
|
default:return "第 " + number.toString();
|
|
}
|
|
};
|
|
var localize = {
|
|
ordinalNumber: ordinalNumber,
|
|
era: buildLocalizeFn({
|
|
values: eraValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
quarter: buildLocalizeFn({
|
|
values: quarterValues,
|
|
defaultWidth: "wide",
|
|
argumentCallback: function argumentCallback(quarter) {return quarter - 1;}
|
|
}),
|
|
month: buildLocalizeFn({
|
|
values: monthValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
day: buildLocalizeFn({
|
|
values: dayValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
dayPeriod: buildLocalizeFn({
|
|
values: dayPeriodValues,
|
|
defaultWidth: "wide",
|
|
formattingValues: formattingDayPeriodValues,
|
|
defaultFormattingWidth: "wide"
|
|
})
|
|
};
|
|
//#endregion
|
|
//#region dist/date-fns/locale/_lib/buildMatchFn.js
|
|
function buildMatchFn(args) {
|
|
return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
var width = options.width;
|
|
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
var matchResult = string.match(matchPattern);
|
|
if (!matchResult) return null;
|
|
var matchedString = matchResult[0];
|
|
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);});
|
|
var value;
|
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
var rest = string.slice(matchedString.length);
|
|
return {
|
|
value: value,
|
|
rest: rest
|
|
};
|
|
};
|
|
}
|
|
function findKey(object, predicate) {
|
|
for (var key in object) if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) return key;
|
|
}
|
|
function findIndex(array, predicate) {
|
|
for (var key = 0; key < array.length; key++) if (predicate(array[key])) return key;
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/locale/_lib/buildMatchPatternFn.js
|
|
function buildMatchPatternFn(args) {
|
|
return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
var matchResult = string.match(args.matchPattern);
|
|
if (!matchResult) return null;
|
|
var matchedString = matchResult[0];
|
|
var parseResult = string.match(args.parsePattern);
|
|
if (!parseResult) return null;
|
|
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
var rest = string.slice(matchedString.length);
|
|
return {
|
|
value: value,
|
|
rest: rest
|
|
};
|
|
};
|
|
}
|
|
//#endregion
|
|
//#region dist/date-fns/locale/zh-CN.js
|
|
/**
|
|
* @category Locales
|
|
* @summary Chinese Simplified locale.
|
|
* @language Chinese Simplified
|
|
* @iso-639-2 zho
|
|
* @author Changyu Geng [@KingMario](https://github.com/KingMario)
|
|
* @author Song Shuoyun [@fnlctrl](https://github.com/fnlctrl)
|
|
* @author sabrinaM [@sabrinamiao](https://github.com/sabrinamiao)
|
|
* @author Carney Wu [@cubicwork](https://github.com/cubicwork)
|
|
* @author Terrence Lam [@skyuplam](https://github.com/skyuplam)
|
|
*/
|
|
var zhCN = {
|
|
code: "zh-CN",
|
|
formatDistance: formatDistance,
|
|
formatLong: formatLong,
|
|
formatRelative: formatRelative,
|
|
localize: localize,
|
|
match: {
|
|
ordinalNumber: buildMatchPatternFn({
|
|
matchPattern: /^(第\s*)?\d+(日|时|分|秒)?/i,
|
|
parsePattern: /\d+/i,
|
|
valueCallback: function valueCallback(value) {return parseInt(value, 10);}
|
|
}),
|
|
era: buildMatchFn({
|
|
matchPatterns: {
|
|
narrow: /^(前)/i,
|
|
abbreviated: /^(前)/i,
|
|
wide: /^(公元前|公元)/i
|
|
},
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: { any: [/^(前)/i, /^(公元)/i] },
|
|
defaultParseWidth: "any"
|
|
}),
|
|
quarter: buildMatchFn({
|
|
matchPatterns: {
|
|
narrow: /^[1234]/i,
|
|
abbreviated: /^第[一二三四]刻/i,
|
|
wide: /^第[一二三四]刻钟/i
|
|
},
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: { any: [
|
|
/(1|一)/i,
|
|
/(2|二)/i,
|
|
/(3|三)/i,
|
|
/(4|四)/i]
|
|
},
|
|
defaultParseWidth: "any",
|
|
valueCallback: function valueCallback(index) {return index + 1;}
|
|
}),
|
|
month: buildMatchFn({
|
|
matchPatterns: {
|
|
narrow: /^(一|二|三|四|五|六|七|八|九|十[二一]?)/i,
|
|
abbreviated: /^(一|二|三|四|五|六|七|八|九|十[二一]?|\d|1[0-2])月/i,
|
|
wide: /^(一|二|三|四|五|六|七|八|九|十[二一]?)月/i
|
|
},
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: {
|
|
narrow: [
|
|
/^一/i,
|
|
/^二/i,
|
|
/^三/i,
|
|
/^四/i,
|
|
/^五/i,
|
|
/^六/i,
|
|
/^七/i,
|
|
/^八/i,
|
|
/^九/i,
|
|
/^十(?!(一|二))/i,
|
|
/^十一/i,
|
|
/^十二/i],
|
|
|
|
any: [
|
|
/^(一|1(?!\d))/i,
|
|
/^(二|2)/i,
|
|
/^(三|3)/i,
|
|
/^(四|4)/i,
|
|
/^(五|5)/i,
|
|
/^(六|6)/i,
|
|
/^(七|7)/i,
|
|
/^(八|8)/i,
|
|
/^(九|9)/i,
|
|
/^(十(?!(一|二))|10)/i,
|
|
/^(十一|11)/i,
|
|
/^(十二|12)/i]
|
|
|
|
},
|
|
defaultParseWidth: "any"
|
|
}),
|
|
day: buildMatchFn({
|
|
matchPatterns: {
|
|
narrow: /^[一二三四五六日]/i,
|
|
short: /^[一二三四五六日]/i,
|
|
abbreviated: /^周[一二三四五六日]/i,
|
|
wide: /^星期[一二三四五六日]/i
|
|
},
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: { any: [
|
|
/日/i,
|
|
/一/i,
|
|
/二/i,
|
|
/三/i,
|
|
/四/i,
|
|
/五/i,
|
|
/六/i]
|
|
},
|
|
defaultParseWidth: "any"
|
|
}),
|
|
dayPeriod: buildMatchFn({
|
|
matchPatterns: { any: /^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i },
|
|
defaultMatchWidth: "any",
|
|
parsePatterns: { any: {
|
|
am: /^上午?/i,
|
|
pm: /^下午?/i,
|
|
midnight: /^午夜/i,
|
|
noon: /^[中正]午/i,
|
|
morning: /^早上/i,
|
|
afternoon: /^下午/i,
|
|
evening: /^晚上?/i,
|
|
night: /^凌晨/i
|
|
} },
|
|
defaultParseWidth: "any"
|
|
})
|
|
},
|
|
options: {
|
|
weekStartsOn: 1,
|
|
firstWeekContainsDate: 4
|
|
}
|
|
};
|
|
//#endregion
|
|
//#region dist/date-fns/_entries/locale/zh-CN/cdn.js
|
|
window.dateFns = _objectSpread(_objectSpread({},
|
|
window.dateFns), {}, {
|
|
locale: _objectSpread(_objectSpread({}, (_window$dateFns =
|
|
window.dateFns) === null || _window$dateFns === void 0 ? void 0 : _window$dateFns.locale), {}, {
|
|
zhCN: zhCN }) });
|
|
|
|
|
|
//#endregion
|
|
|
|
console.log("date-fns CDN files have moved to @date-fns/cdn. Please update your URLs. See: https://date-fns.org/docs/CDN");
|
|
})(); |