global datetime and .setTime()?

If timevar is a global of type datetime, is there any reason why globals.timevar.setTime(value) should not work?

After tearing out grey hairs today, I found that this doesn’t work (result is always today’s date):

var upd_ms = upd_days * 86400000;
globals.sub_renew_to.setTime(sub_renew_date.getTime() + upd_ms);

But doing it the long way around like this does get the expected/desired result:

var upd_ms = upd_days * 86400000;
var sub_renew_to = new Date();
sub_renew_to.setTime(sub_renew_date.getTime() + upd_ms);
globals.sub_renew_to = sub_renew_to;

Environment: “Servoy R2 2.0.4 build-277 on Linux using Java 1.4.2_03”

Thanks,
Neale.

yes the second way is the way it has to be done. There is no other way
You can’t directly set the time on globals We had to do that because else we didn’t see any changes (because you update an internal value of the date object)

So the behavour is the same as with all other types of data (string or numbers) you have to reallt assign it back.

Oh, wish I’d known that a few days ago :-(

Can this be extrapolaed to a generalisation that a construct of the form globals.foo.function() which attempts to set foo (or something therein) will not work, for all data types and all functions?

Thanks,
Neale.