To use the nextFriday()
function from the date-fns
library in TypeScript, you can follow these steps:
date-fns
library by running the following command in your terminal:21 chars2 lines
nextFriday()
function from the date-fns
library at the top of your TypeScript file:index.ts39 chars2 lines
nextFriday()
function in your code to get the date of the next Friday:index.ts210 chars4 lines
Note: You can pass an optional second argument to the nextFriday()
function to indicate the week start, default is Monday. For instance, calling nextFriday(today, {weekStartsOn: 0})
returns the date of the next Friday using Sunday as the week start.
gistlibby LogSnag