registration
This commit is contained in:
64
frontend/style/node_modules/date-fns/format.js
generated
vendored
64
frontend/style/node_modules/date-fns/format.js
generated
vendored
@@ -1,28 +1,18 @@
|
||||
"use strict";
|
||||
exports.format = exports.formatDate = format;
|
||||
Object.defineProperty(exports, "formatters", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _index3.formatters;
|
||||
},
|
||||
});
|
||||
Object.defineProperty(exports, "longFormatters", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _index4.longFormatters;
|
||||
},
|
||||
});
|
||||
var _index = require("./_lib/defaultLocale.js");
|
||||
var _index2 = require("./_lib/defaultOptions.js");
|
||||
var _index3 = require("./_lib/format/formatters.js");
|
||||
var _index4 = require("./_lib/format/longFormatters.js");
|
||||
var _index5 = require("./_lib/protectedTokens.js");
|
||||
|
||||
var _index6 = require("./isValid.js");
|
||||
var _index7 = require("./toDate.js");
|
||||
import { defaultLocale } from "./_lib/defaultLocale.js";
|
||||
import { getDefaultOptions } from "./_lib/defaultOptions.js";
|
||||
import { formatters } from "./_lib/format/formatters.js";
|
||||
import { longFormatters } from "./_lib/format/longFormatters.js";
|
||||
import {
|
||||
isProtectedDayOfYearToken,
|
||||
isProtectedWeekYearToken,
|
||||
warnOrThrowProtectedError,
|
||||
} from "./_lib/protectedTokens.js";
|
||||
import { isValid } from "./isValid.js";
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
// Rexports of internal for libraries to use.
|
||||
// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874
|
||||
export { formatters, longFormatters };
|
||||
|
||||
// This RegExp consists of three parts separated by `|`:
|
||||
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
||||
@@ -46,6 +36,8 @@ const escapedStringRegExp = /^'([^]*?)'?$/;
|
||||
const doubleQuoteRegExp = /''/g;
|
||||
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
||||
|
||||
export { format as formatDate };
|
||||
|
||||
/**
|
||||
* The {@link format} function options.
|
||||
*/
|
||||
@@ -301,8 +293,6 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
||||
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
||||
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
||||
*
|
||||
* @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 original date
|
||||
* @param format - The string of tokens
|
||||
* @param options - An object with options
|
||||
@@ -336,10 +326,9 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
||||
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
||||
* //=> "3 o'clock"
|
||||
*/
|
||||
function format(date, formatStr, options) {
|
||||
const defaultOptions = (0, _index2.getDefaultOptions)();
|
||||
const locale =
|
||||
options?.locale ?? defaultOptions.locale ?? _index.defaultLocale;
|
||||
export function format(date, formatStr, options) {
|
||||
const defaultOptions = getDefaultOptions();
|
||||
const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;
|
||||
|
||||
const firstWeekContainsDate =
|
||||
options?.firstWeekContainsDate ??
|
||||
@@ -355,9 +344,9 @@ function format(date, formatStr, options) {
|
||||
defaultOptions.locale?.options?.weekStartsOn ??
|
||||
0;
|
||||
|
||||
const originalDate = (0, _index7.toDate)(date);
|
||||
const originalDate = toDate(date, options?.in);
|
||||
|
||||
if (!(0, _index6.isValid)(originalDate)) {
|
||||
if (!isValid(originalDate)) {
|
||||
throw new RangeError("Invalid time value");
|
||||
}
|
||||
|
||||
@@ -366,7 +355,7 @@ function format(date, formatStr, options) {
|
||||
.map((substring) => {
|
||||
const firstCharacter = substring[0];
|
||||
if (firstCharacter === "p" || firstCharacter === "P") {
|
||||
const longFormatter = _index4.longFormatters[firstCharacter];
|
||||
const longFormatter = longFormatters[firstCharacter];
|
||||
return longFormatter(substring, locale.formatLong);
|
||||
}
|
||||
return substring;
|
||||
@@ -384,7 +373,7 @@ function format(date, formatStr, options) {
|
||||
return { isToken: false, value: cleanEscapedString(substring) };
|
||||
}
|
||||
|
||||
if (_index3.formatters[firstCharacter]) {
|
||||
if (formatters[firstCharacter]) {
|
||||
return { isToken: true, value: substring };
|
||||
}
|
||||
|
||||
@@ -418,14 +407,14 @@ function format(date, formatStr, options) {
|
||||
|
||||
if (
|
||||
(!options?.useAdditionalWeekYearTokens &&
|
||||
(0, _index5.isProtectedWeekYearToken)(token)) ||
|
||||
isProtectedWeekYearToken(token)) ||
|
||||
(!options?.useAdditionalDayOfYearTokens &&
|
||||
(0, _index5.isProtectedDayOfYearToken)(token))
|
||||
isProtectedDayOfYearToken(token))
|
||||
) {
|
||||
(0, _index5.warnOrThrowProtectedError)(token, formatStr, String(date));
|
||||
warnOrThrowProtectedError(token, formatStr, String(date));
|
||||
}
|
||||
|
||||
const formatter = _index3.formatters[token[0]];
|
||||
const formatter = formatters[token[0]];
|
||||
return formatter(originalDate, token, locale.localize, formatterOptions);
|
||||
})
|
||||
.join("");
|
||||
@@ -440,3 +429,6 @@ function cleanEscapedString(input) {
|
||||
|
||||
return matched[1].replace(doubleQuoteRegExp, "'");
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default format;
|
||||
|
||||
Reference in New Issue
Block a user