Skip to content Skip to sidebar Skip to footer

How To Find The Dates Of Coming Saturday And Sunday From Today's Date In Typescript?

I have set today's date in code as follows, public fromDate: Date = new Date(); How can i find the dates of coming saturday and sunday, mean this weekend dates from the above? i

Solution 1:

If you don't mind using an external library, you can use moment's day function.

import * as moment from 'moment';
const fromDate = moment();
const nextSunday = fromDate.day(7);
console.log(nextSunday.calendar());

Post a Comment for "How To Find The Dates Of Coming Saturday And Sunday From Today's Date In Typescript?"