I am quite new to playwright and I'm struggling to find a solution on how I can populate a value with an automatically adjusting date stamp.
Does anyone know a way I can have it automatically populate with the current date, in the yyyy/mm/dd format, plus an extra day?
This is the command line for populating it with a fixed value:
await page.locator('input[type="date"]').fill('2023-01-20');
I'm guessing the .fill()
will need a different line in there, but I'm just not sure how to do it.
Must be a date stamp without the time, so Date.now()
for example does not work.
I've seen that the following is potentially a simple solution to my problem:
var date = new Date();
date.setDate(date.getDate() + 1);
But how would incorporate that into this line?
await page.locator('input[type="date"]').fill('2023-01-20');
Not sure why this was closed, I've found no answer to my question in other people's questions. I'm not trying to convert the format, i'm trying to input the date +1 day into my code. And yes this is in playwright.