aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/date-fns/formatRelative
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-06-29 11:49:28 -0700
committerPinapelz <yukais@pinapelz.com>2025-06-29 11:49:28 -0700
commitd55b767039605256c736166a942a9138e3eacfd7 (patch)
tree947063b634c50d438a794325f13275e134aa5993 /node_modules/date-fns/formatRelative
parent864ce67d89c77d8ef9c3361f80d619853abcf91c (diff)
remove dev node_modules (oops)
Diffstat (limited to 'node_modules/date-fns/formatRelative')
-rw-r--r--node_modules/date-fns/formatRelative/index.d.ts4
-rw-r--r--node_modules/date-fns/formatRelative/index.js101
-rw-r--r--node_modules/date-fns/formatRelative/index.js.flow59
-rw-r--r--node_modules/date-fns/formatRelative/package.json5
4 files changed, 0 insertions, 169 deletions
diff --git a/node_modules/date-fns/formatRelative/index.d.ts b/node_modules/date-fns/formatRelative/index.d.ts
deleted file mode 100644
index 1c5c739..0000000
--- a/node_modules/date-fns/formatRelative/index.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
-
-import { formatRelative } from 'date-fns'
-export default formatRelative
diff --git a/node_modules/date-fns/formatRelative/index.js b/node_modules/date-fns/formatRelative/index.js
deleted file mode 100644
index f902b41..0000000
--- a/node_modules/date-fns/formatRelative/index.js
+++ /dev/null
@@ -1,101 +0,0 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = formatRelative;
-var _index = require("../_lib/defaultOptions/index.js");
-var _index2 = _interopRequireDefault(require("../differenceInCalendarDays/index.js"));
-var _index3 = _interopRequireDefault(require("../format/index.js"));
-var _index4 = _interopRequireDefault(require("../_lib/defaultLocale/index.js"));
-var _index5 = _interopRequireDefault(require("../subMilliseconds/index.js"));
-var _index6 = _interopRequireDefault(require("../toDate/index.js"));
-var _index7 = _interopRequireDefault(require("../_lib/getTimezoneOffsetInMilliseconds/index.js"));
-var _index8 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
-var _index9 = _interopRequireDefault(require("../_lib/toInteger/index.js"));
-/**
- * @name formatRelative
- * @category Common Helpers
- * @summary Represent the date in words relative to the given base date.
- *
- * @description
- * Represent the date in words relative to the given base date.
- *
- * | Distance to the base date | Result |
- * |---------------------------|---------------------------|
- * | Previous 6 days | last Sunday at 04:30 AM |
- * | Last day | yesterday at 04:30 AM |
- * | Same day | today at 04:30 AM |
- * | Next day | tomorrow at 04:30 AM |
- * | Next 6 days | Sunday at 04:30 AM |
- * | Other | 12/31/2017 |
- *
- * @param {Date|Number} date - the date to format
- * @param {Date|Number} baseDate - the date to compare with
- * @param {Object} [options] - an object with options.
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
- * @returns {String} the date in words
- * @throws {TypeError} 2 arguments required
- * @throws {RangeError} `date` must not be Invalid Date
- * @throws {RangeError} `baseDate` must not be Invalid Date
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
- * @throws {RangeError} `options.locale` must contain `localize` property
- * @throws {RangeError} `options.locale` must contain `formatLong` property
- * @throws {RangeError} `options.locale` must contain `formatRelative` property
- *
- * @example
- * // Represent the date of 6 days ago in words relative to the given base date. In this example, today is Wednesday
- * const result = formatRelative(addDays(new Date(), -6), new Date())
- * //=> "last Thursday at 12:45 AM"
- */
-function formatRelative(dirtyDate, dirtyBaseDate, options) {
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$weekStartsOn, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2;
- (0, _index8.default)(2, arguments);
- var date = (0, _index6.default)(dirtyDate);
- var baseDate = (0, _index6.default)(dirtyBaseDate);
- var defaultOptions = (0, _index.getDefaultOptions)();
- var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index4.default;
- var weekStartsOn = (0, _index9.default)((_ref2 = (_ref3 = (_ref4 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.weekStartsOn) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : 0);
- if (!locale.localize) {
- throw new RangeError('locale must contain localize property');
- }
- if (!locale.formatLong) {
- throw new RangeError('locale must contain formatLong property');
- }
- if (!locale.formatRelative) {
- throw new RangeError('locale must contain formatRelative property');
- }
- var diff = (0, _index2.default)(date, baseDate);
- if (isNaN(diff)) {
- throw new RangeError('Invalid time value');
- }
- var token;
- if (diff < -6) {
- token = 'other';
- } else if (diff < -1) {
- token = 'lastWeek';
- } else if (diff < 0) {
- token = 'yesterday';
- } else if (diff < 1) {
- token = 'today';
- } else if (diff < 2) {
- token = 'tomorrow';
- } else if (diff < 7) {
- token = 'nextWeek';
- } else {
- token = 'other';
- }
- var utcDate = (0, _index5.default)(date, (0, _index7.default)(date));
- var utcBaseDate = (0, _index5.default)(baseDate, (0, _index7.default)(baseDate));
- var formatStr = locale.formatRelative(token, utcDate, utcBaseDate, {
- locale: locale,
- weekStartsOn: weekStartsOn
- });
- return (0, _index3.default)(date, formatStr, {
- locale: locale,
- weekStartsOn: weekStartsOn
- });
-}
-module.exports = exports.default; \ No newline at end of file
diff --git a/node_modules/date-fns/formatRelative/index.js.flow b/node_modules/date-fns/formatRelative/index.js.flow
deleted file mode 100644
index 00280b2..0000000
--- a/node_modules/date-fns/formatRelative/index.js.flow
+++ /dev/null
@@ -1,59 +0,0 @@
-// @flow
-// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
-
-export type Interval = {
- start: Date | number,
- end: Date | number,
-}
-
-export type Locale = {
- code?: string,
- formatDistance?: (...args: Array<any>) => any,
- formatRelative?: (...args: Array<any>) => any,
- localize?: {
- ordinalNumber: (...args: Array<any>) => any,
- era: (...args: Array<any>) => any,
- quarter: (...args: Array<any>) => any,
- month: (...args: Array<any>) => any,
- day: (...args: Array<any>) => any,
- dayPeriod: (...args: Array<any>) => any,
- },
- formatLong?: {
- date: (...args: Array<any>) => any,
- time: (...args: Array<any>) => any,
- dateTime: (...args: Array<any>) => any,
- },
- match?: {
- ordinalNumber: (...args: Array<any>) => any,
- era: (...args: Array<any>) => any,
- quarter: (...args: Array<any>) => any,
- month: (...args: Array<any>) => any,
- day: (...args: Array<any>) => any,
- dayPeriod: (...args: Array<any>) => any,
- },
- options?: {
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
- firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
- },
-}
-
-export type Duration = {
- years?: number,
- months?: number,
- weeks?: number,
- days?: number,
- hours?: number,
- minutes?: number,
- seconds?: number,
-}
-
-export type Day = 0 | 1 | 2 | 3 | 4 | 5 | 6
-
-declare module.exports: (
- date: Date | number,
- baseDate: Date | number,
- options?: {
- locale?: Locale,
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
- }
-) => string
diff --git a/node_modules/date-fns/formatRelative/package.json b/node_modules/date-fns/formatRelative/package.json
deleted file mode 100644
index 179e386..0000000
--- a/node_modules/date-fns/formatRelative/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "sideEffects": false,
- "module": "../esm/formatRelative/index.js",
- "typings": "../typings.d.ts"
-} \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage