You can use the nextFriday
function from the date-fns library to get the next Friday date from a given date.
Here's an example code snippet:
index.tsx288 chars7 lines
In the above code:
nextFriday
function from date-fns
using the destructuring syntax.Date
object with the date we want to find the next Friday from.nextFriday
function with the created Date
object and store the result in nextFridayDate
. This returns the next Friday date from the given date.nextFridayDate
to the console.Note: The nextFriday
function returns a Date
object with the time set to 00:00:00 hours.
gistlibby LogSnag