get the current year typescript code example Example: ts get year from date new Date().getFullYear();