To get the date of the last day of the current week in JavaScript, you can use the getDay()
method to get the current day of the week and then subtract that number of days from the current date.
Here's an example using plain JavaScript:
index.tsx166 chars5 lines
This will output the date for the last day of the current week.
Alternatively, you can use a library like date-fns or Moment.js to make date manipulation easier.
Here's an example using date-fns:
index.tsx147 chars7 lines
And here's an example using Moment.js:
index.tsx131 chars7 lines
gistlibby LogSnag