I have a sharepoint 2019 site. in this site i create a list with two column (1.name[text type] 2.Date[DateTime Type]). then i design this list in infopath. When I want to add a new item, I change the date field value to a new Hijri value (1398/05/27). So far everything is working properly. The challenge is that when I want to save this item, I have to change it again to Gregorian (2019-08-18). i do this by javascript and change onclick event of Save button.
document.getElementById(SaveButton.id).setAttribute("onclick", "$.when(changeDatesBeforeSave()).then(Button.OnClick(this, event));");
function changeDatesBeforeSave() {
//my statements for Convert Hijri Date to Gregorian Date .......
//Gregorian_Date is now set Correctly .....
//dtcontrolId is input field that keep Date ....
document.getElementById(dtcontrolId).value = miladiDate;
}
when i click Save button, value in date field changed but it back again to previous value.
dtcontrolId // my input date field (it is date picker)
main value : 2019-08-18
first change Gregorian to Hijri : 1398/05/27
user change date to : 1398/02/11
second change Hijri to Gregorian : 2019-05-01
but after press save button value change again to : 2019-08-18
why this change back again? i hope can explain Problem.


