Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function addDays(date = new Date(), days = 0) {
const dateClone = new Date(date); // date is an object provided by reference, we need to clone it
dateClone.setDate(date.getDate() + days);
return dateClone;
const tomorrowDate = (date, days = 1) => addDays(date, days);
it("Test tomorrowDate function", () => {
cosnt testDateString = "2018-01-01T00:00:00.000Z"
const testDate = new Date(testString);
const testTomorrowDate = new Date("2018-01-02T00:00:00.000Z");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment