To use the subISOWeekYears
function from the date-fns
library in TypeScript, you can follow the below steps.
date-fns
library as a dependency in your project using npm or Yarn.21 chars2 lines
or
18 chars2 lines
subISOWeekYears
function in your TypeScript file where you want to use it.44 chars2 lines
subISOWeekYears
function to subtract the specified number of ISO week-numbering years from the given date.184 chars7 lines
In the above example, we are subtracting 2 ISO week-numbering years from the date 2022-07-01
and the output is 2020-07-03T00:00:00.000Z
. The subISOWeekYears
function takes two arguments - the first argument is the date to subtract years from, and the second argument is the number of ISO week-numbering years to subtract.
gistlibby LogSnag