GitHub 6248★

Check if a date is today

JavaScript version

// `date` is a Date object
const isToday = (date) => date.toISOString().slice(0, 10) === new Date().toISOString().slice(0, 10);

TypeScript version

const isToday = (date: Date): boolean => date.toISOString().slice(0, 10) === new Date().toISOString().slice(0, 10);
Follow me on and to get more useful contents.