I've been using this function to display and change a date in a custom form (this was working fine for more than one year):

function GetUserDateInfo(dn, fldName, attrName)
if ( dn == "" ) return;
var lvDateArrival = IDVault.get(null,dn,"user", attrName);
var datestr = String(lvDateArrival);
if ( String(lvDateArrival).length >= 8 )
var edd=new Date(datestr.substring(0, 4), (Number(datestr.substring(4, 6))-1), datestr.substring(6, 8));
form.setValues("ArrivalDate", form.dateToString(edd));

alert( fldName+": error getting "+attrName+" for "+dn+" : "+e );
The date is then changed in eDir with an entity activity.

I'm not sure if it's because of last updates (edir 9.04 + idm 4.5.6) but since last October 2017, my form no longer work, the date is decreased one day each time the form is submited.

Here how I analyzed the steps:
1) The get attribute return the date like 20180129230000Z
2) Which represent Monday Jan 29 2018 00:00:00 GMT + 0100 (January 29 Midnight)
3) The script make a string of the value then a date from the string to make it visible in date picker.
3) The entity Activity writes 01/29/2018 12:00:00 AM to eDir
4) Then you load the form again
5) The get attribute return the date like 20180128230000Z which is January 28 Midnight.
An you lost one day !!!
The problem is that 01/29/2018 12:00:00 AM is not written like Jan 29 midnight but 29 at 00H in the morning by the entity activity.

I tried many different options, changing DAL attribute to dateTime + form control to DateTime, but nothing changed.

Any idea to make sure the the entity activity does not change the date ?