GitHub 6248★

Check if a date occurs in the current year

JavaScript version

// `date` is a Date object
const isCurrentYear = (date) => date.getUTCFullYear() === new Date().getUTCFullYear();

TypeScript version

const isCurrentYear = (date: Date): boolean => date.getUTCFullYear() === new Date().getUTCFullYear();
Follow me on and to get more useful contents.