Files
wehub-resource-sync 221778fa98
rowboat / apps/x Vitest suites (push) Has been cancelled
rowboat / apps/x Electron package smoke test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:33:34 +08:00

19 lines
736 B
TypeScript

export function isToday(date: Date): boolean {
const today = new Date();
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear();
}
export function isThisWeek(date: Date): boolean {
const now = new Date();
const weekStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay());
const weekEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()));
return date >= weekStart && date <= weekEnd;
}
export function isThisMonth(date: Date): boolean {
const now = new Date();
return date.getMonth() === now.getMonth() &&
date.getFullYear() === now.getFullYear();
}