There is some sort of strange behavior going on when you make a copy of a date that comes from either a JSDataset or from a JSRecord. [edit also from utils.dateFormat)]
It appears that the copied date is actually just a reference back to the original date, leading to some very unexpected results once you start manipulating the date.
This has not always been the case, but I’m not sure when it started.
var rTest = foundset.getRecord(1);
var dOriginal = rTest.mydate;
var dCopy = new Date(dOriginal);
dCopy.setDate(dCopy.getDate() +7); //dOriginal also changes!
You can get around the issue if you double wrap the copy operation (make a new Date of a new Date).
Servoy 5.2.15
Edit: Uploaded new sample solution. The problem also exists with dates coming out of utils.dateFormat
PersistantDateReference.servoy (4.44 KB)