Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 442 Bytes

check-if-a-date-occurs-in-the-current-year.mdx

File metadata and controls

19 lines (15 loc) · 442 Bytes
category created title updated
Validator
2021-04-13
Check if a date occurs in the current year
2021-10-13

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();