The goal is for selectedDay to be assigned the value of the system variable Mainpackage.subclass0.subclass1.firstDay and then incremented by two days. Mainpackage.subclass0.subclass1.firstDay needs to be unchanged.
Important system variable in red.
To be ‘manipulated and used’ variable in green.
Even with an intermediary, third, dummy variable it doesn’t work:
//Declarations and instantiations
var [COLOR="Orange"]systemDate[/COLOR] = new Date();
var [COLOR="SeaGreen"]selectedDay[/COLOR] = new Date();
[COLOR="Red"]Mainpackage.subclass0.subclass1.firstDay[/COLOR];
//Assignments and manipulations
[COLOR="Orange"]systemDate[/COLOR] = [COLOR="Red"]Mainpackage.subclass0.subclass1.firstDay[/COLOR];
[COLOR="SeaGreen"]selectedDay[/COLOR] = [COLOR="Orange"]systemDate[/COLOR];
[COLOR="SeaGreen"]selectedDay[/COLOR].setDate([COLOR="SeaGreen"]selectedDay[/COLOR].getDate()+2);
//Logging
console.log('Mainpackage.subclass0.subclass1.firstDay: ' +Mainpackage.subclass0.subclass1.firstDay +'\
' +'systemDate: ' +systemDate +'\
' +'selectedDay :' +selectedDay +'\
');
Console log is:
Mainpackage.subclass0.subclass1.firstDay: Tue Aug 24 2010 00:00:00 GMT-0400 (Eastern Daylight Time)
systemDate: Tue Aug 24 2010 00:00:00 GMT-0400 (Eastern Daylight Time)
selectedDay: Tue Aug 24 2010 00:00:00 GMT-0400 (Eastern Daylight Time)
It doesn’t work in my webapp : All variables change at the same time.