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