Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Date calculation

ra_be
Level 2
Level 2

Hello,

I am trying to figure out how to calculate with dates in LCD-Javascript. But I need a bit support.

The user shall enter a date into a "datetimefield" and a another "datetimefield" shall show 2 months ahead (entered date plus 2 months).

Thanks for help.

Regards,

ra_be

0 Replies
ra_be
Level 2
Level 2

Dear Paul,

thanks for the link, but it has not worked out.

I have tried below code:

if (this.rawValue != null ){

var oDate = util.scand("mm/dd/yyyy", page1.dateField1.formattedValue);

var sFullYear = oDate.getFullYear();

var sMonth = oDate.getMonth();

var sDate = oDate.getDate();

dateField2.formattedvalue = util.printd("mm/dd/yyyy", new Date(sFullYear, sMonth, sDate));

page1.dateField2.rawValue = dateField2.formattedvalue;

}

Even only to take one date from one datetimefield and put into the other ones. But "oDate has no properties" appears.

May you have an idea? I just want get one date, add a month and put the new date into a datefield.

Thanks a lot.

Regards,

ra_be

ra_be
Level 2
Level 2

Got it!

just had to change the following line:

var oDate = util.scand("yyyy-mm-dd", page1.dateField1.rawValue);

Thanks.

ra_be