mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
Show a report for total users chart
This commit is contained in:
parent
794938db72
commit
4d064adf1b
5397 changed files with 313100 additions and 365 deletions
58
node_modules/date-fns/isWithinInterval.js
generated
vendored
Normal file
58
node_modules/date-fns/isWithinInterval.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link isWithinInterval} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name isWithinInterval
|
||||
* @category Interval Helpers
|
||||
* @summary Is the given date within the interval?
|
||||
*
|
||||
* @description
|
||||
* Is the given date within the interval? (Including start and end.)
|
||||
*
|
||||
* @param date - The date to check
|
||||
* @param interval - The interval to check
|
||||
* @param options - An object with options
|
||||
*
|
||||
* @returns The date is within the interval
|
||||
*
|
||||
* @example
|
||||
* // For the date within the interval:
|
||||
* isWithinInterval(new Date(2014, 0, 3), {
|
||||
* start: new Date(2014, 0, 1),
|
||||
* end: new Date(2014, 0, 7)
|
||||
* })
|
||||
* // => true
|
||||
*
|
||||
* @example
|
||||
* // For the date outside of the interval:
|
||||
* isWithinInterval(new Date(2014, 0, 10), {
|
||||
* start: new Date(2014, 0, 1),
|
||||
* end: new Date(2014, 0, 7)
|
||||
* })
|
||||
* // => false
|
||||
*
|
||||
* @example
|
||||
* // For date equal to the interval start:
|
||||
* isWithinInterval(date, { start, end: date })
|
||||
* // => true
|
||||
*
|
||||
* @example
|
||||
* // For date equal to the interval end:
|
||||
* isWithinInterval(date, { start: date, end })
|
||||
* // => true
|
||||
*/
|
||||
export function isWithinInterval(date, interval, options) {
|
||||
const time = +toDate(date, options?.in);
|
||||
const [startTime, endTime] = [
|
||||
+toDate(interval.start, options?.in),
|
||||
+toDate(interval.end, options?.in),
|
||||
].sort((a, b) => a - b);
|
||||
|
||||
return time >= startTime && time <= endTime;
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default isWithinInterval;
|
Loading…
Add table
Add a link
Reference in a new issue