aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/date-fns/formatDistance
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/formatDistance
parent864ce67d89c77d8ef9c3361f80d619853abcf91c (diff)
remove dev node_modules (oops)
Diffstat (limited to 'node_modules/date-fns/formatDistance')
-rw-r--r--node_modules/date-fns/formatDistance/index.d.ts4
-rw-r--r--node_modules/date-fns/formatDistance/index.js211
-rw-r--r--node_modules/date-fns/formatDistance/index.js.flow60
-rw-r--r--node_modules/date-fns/formatDistance/package.json5
4 files changed, 0 insertions, 280 deletions
diff --git a/node_modules/date-fns/formatDistance/index.d.ts b/node_modules/date-fns/formatDistance/index.d.ts
deleted file mode 100644
index 656c64a..0000000
--- a/node_modules/date-fns/formatDistance/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 { formatDistance } from 'date-fns'
-export default formatDistance
diff --git a/node_modules/date-fns/formatDistance/index.js b/node_modules/date-fns/formatDistance/index.js
deleted file mode 100644
index 9e0d299..0000000
--- a/node_modules/date-fns/formatDistance/index.js
+++ /dev/null
@@ -1,211 +0,0 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = formatDistance;
-var _index = require("../_lib/defaultOptions/index.js");
-var _index2 = _interopRequireDefault(require("../compareAsc/index.js"));
-var _index3 = _interopRequireDefault(require("../differenceInMonths/index.js"));
-var _index4 = _interopRequireDefault(require("../differenceInSeconds/index.js"));
-var _index5 = _interopRequireDefault(require("../_lib/defaultLocale/index.js"));
-var _index6 = _interopRequireDefault(require("../toDate/index.js"));
-var _index7 = _interopRequireDefault(require("../_lib/cloneObject/index.js"));
-var _index8 = _interopRequireDefault(require("../_lib/assign/index.js"));
-var _index9 = _interopRequireDefault(require("../_lib/getTimezoneOffsetInMilliseconds/index.js"));
-var _index10 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
-var MINUTES_IN_DAY = 1440;
-var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
-var MINUTES_IN_MONTH = 43200;
-var MINUTES_IN_TWO_MONTHS = 86400;
-
-/**
- * @name formatDistance
- * @category Common Helpers
- * @summary Return the distance between the given dates in words.
- *
- * @description
- * Return the distance between the given dates in words.
- *
- * | Distance between dates | Result |
- * |-------------------------------------------------------------------|---------------------|
- * | 0 ... 30 secs | less than a minute |
- * | 30 secs ... 1 min 30 secs | 1 minute |
- * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
- * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
- * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
- * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
- * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
- * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
- * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
- * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
- * | 1 yr ... 1 yr 3 months | about 1 year |
- * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
- * | 1 yr 9 months ... 2 yrs | almost 2 years |
- * | N yrs ... N yrs 3 months | about N years |
- * | N yrs 3 months ... N yrs 9 months | over N years |
- * | N yrs 9 months ... N+1 yrs | almost N+1 years |
- *
- * With `options.includeSeconds == true`:
- * | Distance between dates | Result |
- * |------------------------|----------------------|
- * | 0 secs ... 5 secs | less than 5 seconds |
- * | 5 secs ... 10 secs | less than 10 seconds |
- * | 10 secs ... 20 secs | less than 20 seconds |
- * | 20 secs ... 40 secs | half a minute |
- * | 40 secs ... 60 secs | less than a minute |
- * | 60 secs ... 90 secs | 1 minute |
- *
- * @param {Date|Number} date - the date
- * @param {Date|Number} baseDate - the date to compare with
- * @param {Object} [options] - an object with options.
- * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed
- * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
- * @returns {String} the distance 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.locale` must contain `formatDistance` property
- *
- * @example
- * // What is the distance between 2 July 2014 and 1 January 2015?
- * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))
- * //=> '6 months'
- *
- * @example
- * // What is the distance between 1 January 2015 00:00:15
- * // and 1 January 2015 00:00:00, including seconds?
- * const result = formatDistance(
- * new Date(2015, 0, 1, 0, 0, 15),
- * new Date(2015, 0, 1, 0, 0, 0),
- * { includeSeconds: true }
- * )
- * //=> 'less than 20 seconds'
- *
- * @example
- * // What is the distance from 1 January 2016
- * // to 1 January 2015, with a suffix?
- * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {
- * addSuffix: true
- * })
- * //=> 'about 1 year ago'
- *
- * @example
- * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
- * import { eoLocale } from 'date-fns/locale/eo'
- * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {
- * locale: eoLocale
- * })
- * //=> 'pli ol 1 jaro'
- */
-
-function formatDistance(dirtyDate, dirtyBaseDate, options) {
- var _ref, _options$locale;
- (0, _index10.default)(2, arguments);
- 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 : _index5.default;
- if (!locale.formatDistance) {
- throw new RangeError('locale must contain formatDistance property');
- }
- var comparison = (0, _index2.default)(dirtyDate, dirtyBaseDate);
- if (isNaN(comparison)) {
- throw new RangeError('Invalid time value');
- }
- var localizeOptions = (0, _index8.default)((0, _index7.default)(options), {
- addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
- comparison: comparison
- });
- var dateLeft;
- var dateRight;
- if (comparison > 0) {
- dateLeft = (0, _index6.default)(dirtyBaseDate);
- dateRight = (0, _index6.default)(dirtyDate);
- } else {
- dateLeft = (0, _index6.default)(dirtyDate);
- dateRight = (0, _index6.default)(dirtyBaseDate);
- }
- var seconds = (0, _index4.default)(dateRight, dateLeft);
- var offsetInSeconds = ((0, _index9.default)(dateRight) - (0, _index9.default)(dateLeft)) / 1000;
- var minutes = Math.round((seconds - offsetInSeconds) / 60);
- var months;
-
- // 0 up to 2 mins
- if (minutes < 2) {
- if (options !== null && options !== void 0 && options.includeSeconds) {
- if (seconds < 5) {
- return locale.formatDistance('lessThanXSeconds', 5, localizeOptions);
- } else if (seconds < 10) {
- return locale.formatDistance('lessThanXSeconds', 10, localizeOptions);
- } else if (seconds < 20) {
- return locale.formatDistance('lessThanXSeconds', 20, localizeOptions);
- } else if (seconds < 40) {
- return locale.formatDistance('halfAMinute', 0, localizeOptions);
- } else if (seconds < 60) {
- return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);
- } else {
- return locale.formatDistance('xMinutes', 1, localizeOptions);
- }
- } else {
- if (minutes === 0) {
- return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);
- } else {
- return locale.formatDistance('xMinutes', minutes, localizeOptions);
- }
- }
-
- // 2 mins up to 0.75 hrs
- } else if (minutes < 45) {
- return locale.formatDistance('xMinutes', minutes, localizeOptions);
-
- // 0.75 hrs up to 1.5 hrs
- } else if (minutes < 90) {
- return locale.formatDistance('aboutXHours', 1, localizeOptions);
-
- // 1.5 hrs up to 24 hrs
- } else if (minutes < MINUTES_IN_DAY) {
- var hours = Math.round(minutes / 60);
- return locale.formatDistance('aboutXHours', hours, localizeOptions);
-
- // 1 day up to 1.75 days
- } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
- return locale.formatDistance('xDays', 1, localizeOptions);
-
- // 1.75 days up to 30 days
- } else if (minutes < MINUTES_IN_MONTH) {
- var days = Math.round(minutes / MINUTES_IN_DAY);
- return locale.formatDistance('xDays', days, localizeOptions);
-
- // 1 month up to 2 months
- } else if (minutes < MINUTES_IN_TWO_MONTHS) {
- months = Math.round(minutes / MINUTES_IN_MONTH);
- return locale.formatDistance('aboutXMonths', months, localizeOptions);
- }
- months = (0, _index3.default)(dateRight, dateLeft);
-
- // 2 months up to 12 months
- if (months < 12) {
- var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
- return locale.formatDistance('xMonths', nearestMonth, localizeOptions);
-
- // 1 year up to max Date
- } else {
- var monthsSinceStartOfYear = months % 12;
- var years = Math.floor(months / 12);
-
- // N years up to 1 years 3 months
- if (monthsSinceStartOfYear < 3) {
- return locale.formatDistance('aboutXYears', years, localizeOptions);
-
- // N years 3 months up to N years 9 months
- } else if (monthsSinceStartOfYear < 9) {
- return locale.formatDistance('overXYears', years, localizeOptions);
-
- // N years 9 months up to N year 12 months
- } else {
- return locale.formatDistance('almostXYears', years + 1, localizeOptions);
- }
- }
-}
-module.exports = exports.default; \ No newline at end of file
diff --git a/node_modules/date-fns/formatDistance/index.js.flow b/node_modules/date-fns/formatDistance/index.js.flow
deleted file mode 100644
index b18d1ba..0000000
--- a/node_modules/date-fns/formatDistance/index.js.flow
+++ /dev/null
@@ -1,60 +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?: {
- includeSeconds?: boolean,
- addSuffix?: boolean,
- locale?: Locale,
- }
-) => string
diff --git a/node_modules/date-fns/formatDistance/package.json b/node_modules/date-fns/formatDistance/package.json
deleted file mode 100644
index b58177f..0000000
--- a/node_modules/date-fns/formatDistance/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "sideEffects": false,
- "module": "../esm/formatDistance/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