I have a DateInput on a CAF Screen. I am setting the Value using Javascript and then sending it to the backend.
I am setting the date via the Millisecond method, But I am getting it different.
// startDateLong is the DateTime in MilliSecond
var modalStartDate = CAF.model("#{activePageBean.clientIds['modalStartDate']}");
modalStartDate.setValue(new Date(startDateLong));
Logger.warn("Date being set is "+new Date(startDateLong) +" ## "+new Date(startDateLong).getTime() + "### "+modalStartDate.getValue().getTime());
I have tested for 2 different dates and I am getting two different outputs
Date being set is Fri Aug 23 23:36:40 UTC+0530 1912 ## -1810014800000### -1810014799993
and
Date being set is Tue Aug 28 05:30:00 UTC+0530 2012 ## 1346112000000### 1346112000003
Actual Requirement : I have to save a date value as a string on the screen and then as per requirement have to populate it in the DateInput. Is there another way to consistently do this ?