You can use the built-in Date object in JavaScript to get the current date, subtract a year from it, and then extract the year value. This can be done using the following code:
index.tsx194 chars4 lines
Note that getFullYear()
method returns the year value of a Date object, as a four-digit number.
gistlibby LogSnag