isLeapYear: dateIsLeapYear()

in shared/dates.ts [43:115]


		isLeapYear: dateIsLeapYear(dateObject),
	};
};

export const dateString = (
	inputDate: Date,
	outputFormat: string = DATE_FNS_SHORT_OUTPUT_FORMAT,
) => format(inputDate, outputFormat);

export const dateIsBefore = (inputDate: Date, comparisonDate: Date) =>
	inputDate.valueOf() < comparisonDate.valueOf();

export const dateIsSameOrBefore = (inputDate: Date, comparisonDate: Date) =>
	inputDate.valueOf() <= comparisonDate.valueOf();

export const dateIsAfter = (inputDate: Date, comparisonDate: Date) =>
	inputDate.valueOf() > comparisonDate.valueOf();

export const dateIsSameOrAfter = (inputDate: Date, comparisonDate: Date) =>
	inputDate.valueOf() >= comparisonDate.valueOf();

export const dateIsSame = (inputDate: Date, comparisonDate: Date) =>
	inputDate.valueOf() === comparisonDate.valueOf();

export const dateClone = (inputDate: Date) => new Date(inputDate.valueOf());

export const dateIsLeapYear = (inputDate: Date) => {
	const year = inputDate.getFullYear();
	return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
};

export const dateAddDays = (inputDate: Date, daysModifier: number) => {
	const modifiedDate = new Date(inputDate.valueOf());
	modifiedDate.setDate(modifiedDate.getDate() + daysModifier);
	return modifiedDate;
};

export const dateAddMonths = (inputDate: Date, monthsModifier: number) => {
	const modifiedDate = new Date(inputDate.valueOf());
	modifiedDate.setMonth(modifiedDate.getMonth() + monthsModifier);
	return modifiedDate;
};

export const dateAddYears = (inputDate: Date, yearsModifier: number) => {
	const modifiedDate = new Date(inputDate.valueOf());
	modifiedDate.setFullYear(modifiedDate.getFullYear() + yearsModifier);
	return modifiedDate;
};

export const numberOfDaysInMonth = (inputDate: Date) =>
	new Date(inputDate.getFullYear(), inputDate.getMonth() + 1, 0).getDate();

export const getWeekDay = (inputDate: Date) =>
	new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(inputDate);

export interface DateRange {
	start: Date;
	end: Date;
}
export const dateRange = (
	startDate: string | Date,
	endDate: string | Date,
	dateInputFormat: string = DATE_FNS_INPUT_FORMAT,
): DateRange => {
	const start =
		startDate instanceof Date
			? startDate
			: parse(startDate, dateInputFormat, new Date());
	const end =
		endDate instanceof Date
			? endDate
			: parse(endDate, dateInputFormat, new Date());
	return {