firstYearOfDecade

A function that returns a Date object of the first year in a decade.

firstYearOfDecade(new Date(2017, 0, 1)); // 2010-1-1
firstYearOfDecade(new Date(2007, 10, 22)); // 2000-11-22
firstYearOfDecade(new Date(2026, 0, 1)); // 2020-1-1

Parameters

value Date

Returns

Date - The first year in a decade.

 /