To use the previousTuesday
function from the date-fns
library in JavaScript, first install the library via npm:
21 chars2 lines
Then, import the function into your code and use it like so:
282 chars8 lines
The previousTuesday
function takes in a date object and returns a new date object representing the previous Tuesday relative to the input date.
gistlibby LogSnag