Add 30 days to a date

My simple problem is I can not add 30 days to a date:
For a button click I want to write a date in a field in a collection (today date + 30days).
I do some calc with dates working fine but this one is not working:

export function button10_click(event, $w) {

l et datenow = Date();
let days = (302460601000);
let expiration = datenow+days;
$w(“#dynamicDataset”).setFieldValue(“expirationdate”, expiration);
let originalDate111 = $w(“#text103”).text;
let newDate111 = originalDate111.split(’ ‘).splice(0, 4).join(’ ‘);
$w(’#text103’).text = newDate111;

This way the date is always equal the current date not the current date+30 days.

Any advice?

thanks!
Imre

And the working code is - if anybody needs:
(adding 30 days to a date (today))

var date = new Date();
date.setDate(r.getDate() + 30);

Hi,

You don’t have r defined. I suspect you mean:

let date = new Date();
date.setDate(date.getDate() + 30);

Thx Ysrael,
yep I missed it.

Can you check my other issue with dates comparing in a query?

Thx in advance!
Imre

Hello! I’d like to set an expiration date of 30 days from today, but I cannot tell from this thread what the final code was. Would one of you mind posting the whole code here? @yisrael-wix or @imrebellonphoto