Depreciated. Use getFullYear(). The getYear() method of the Date object returns the year for the date according to local time. If the year is greater than or equal to 2000, the value is 100 or greater. For example, for 2026, getYear() returns 126.

    
    const date = new Date("2020-12-25");

    const year = date.getYear();

    console.log(year)
    // 120