export function isWithinInterval(date: Date, start: Date, end: Date): boolean {
const t = date.getTime();
const lo = Math.min(start.getTime(), end.getTime());
const hi = Math.max(start.getTime(), end.getTime());
return t >= lo && t <= hi;
}
isWithinInterval(new Date('2025-03-15'), new Date('2025-03-01'), new Date('2025-03-31')); // true
isWithinInterval(new Date('2025-04-01'), new Date('2025-03-01'), new Date('2025-03-31')); // false
Create a free account and build your private vault. Share publicly whenever you want.