calendar-date
Version:
Immutable object to represent a calendar date with zero dependencies
52 lines (51 loc) • 1.73 kB
TypeScript
import { CalendarDate } from './CalendarDate';
export declare class CalendarDateRange {
readonly start: CalendarDate;
readonly end: CalendarDate;
constructor(start: CalendarDate, end: CalendarDate, autoArrange?: boolean);
equals(calendarDateRange: CalendarDateRange): boolean;
toString(): string;
toJSON(): string;
/**
* @param isoString pattern YYYY-MM-DD/YYYY-MM-DD
*/
static parse(isoString: string): CalendarDateRange;
/**
* Returns true if the given date ranges have gaps.
* The date ranges will be sorted.
*/
static hasGaps(values: CalendarDateRange[], options?: {
excludeStart?: boolean;
excludeEnd?: boolean;
}): boolean;
/**
* Returns true if the given date ranges overlap.
* The date ranges will be sorted.
*/
static hasOverlap(values: CalendarDateRange[], options?: {
excludeStart?: boolean;
excludeEnd?: boolean;
}): boolean;
/**
* Returns the total amount of days in included in this date range
* including start and end day.
*/
getTotalDays(): number;
/**
* Returns the difference in days between the start and end date.
* See documentation of CalendarDate.getDifferenceInDays for more information.
*/
getDifferenceInDays(): number;
/**
* Returns the difference in months as an integer, ignoring the day values.
*/
getDifferenceInMonths(): number;
includes(calendarDate: CalendarDate, options?: {
excludeStart?: boolean;
excludeEnd?: boolean;
}): boolean;
includes(calendarDateRange: CalendarDateRange, options?: {
excludeStart?: boolean;
excludeEnd?: boolean;
}): boolean;
}