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.

  • I re-read your question 3 times and I am still not sure what you are asking. Can you add more details and maybe, rephrase what you are asking in different words, please? Commented Aug 18, 2019 at 4:30
  • i explain again . Hope you noticed
    – Cawboy
    Commented Aug 18, 2019 at 10:12

1 Answer 1


Maybe instead of using JavaScript, you can just change the Date picker's format to use Hijra?

I am borrowing the answer from Wael.

To do that, follow these steps:

  • Add a date picker control…
  • Right click the control and click properties…

enter image description here

  • In the display tab, click on format
  • Make sure that the locale is the locale is you want. For Arabic or Islamic choose "Arabic (Saudi Arabia)"
  • Click on OK few times!

enter image description here

enter image description here

  • i need Hijri Shamsi (persian Date) and unfortunately sharepoint and infopath don`t support this. also we want save date to Gregorian date format.
    – Cawboy
    Commented Aug 19, 2019 at 8:47
  • I think date picker stores value temporary somewhere other than input element. i guess have to find and change that ...
    – Cawboy
    Commented Aug 19, 2019 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.