# \<encounterDate\> of HTML Form shows incorrect time

**URL:** https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788
**Category:** Ask OpenMRS
**Tags:** html-form-entry, refapp
**Created:** [October 31, 2022, 6:59am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788 "2022-10-31T06:59:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nischith](https://talk.openmrs.org/user_avatar/talk.openmrs.org/nischith/32/13088_2.png) [@nischith](https://talk.openmrs.org/u/nischith)
#### Post date: [October 31, 2022, 6:59am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/1 "2022-10-31T06:59:58Z")

</div>

The system config is _OpenMRS core 2.6.0_/ _Refapp 2.13.0-SNAPSHOT_ / Ubuntu _22.04.1 LTS_

A form has been created using the HTML Form Entry module (v5.1.0-SNAPSHOT). One of the tags used in the form is:

`<encounterDate showTime="true" default="now"/>`

Though the server has been configured to IST timezone, the above tag displays the time in UTC.

Please help in finding a solution to this. Thank you!

---

<div class="post-metadata">

### Author: ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)
#### Post date: [October 31, 2022, 8:05am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/2 "2022-10-31T08:05:43Z")

</div>

The tag should show date-times in the client timezone, regardless of the server’s setting, what’s their timezone in your setup?

---

<div class="post-metadata">

### Author: ![nischith](https://talk.openmrs.org/user_avatar/talk.openmrs.org/nischith/32/13088_2.png) [@nischith](https://talk.openmrs.org/u/nischith)
#### Post date: [October 31, 2022, 8:19am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/3 "2022-10-31T08:19:50Z")

</div>

@mksd Everything is running on the same machine. Both core and the RefApp modules have been installed on the same machine…there is no separate installation of the client. Thanks!

---

<div class="post-metadata">

### Author: ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)
#### Post date: [October 31, 2022, 8:55am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/4 "2022-10-31T08:55:17Z")

</div>

I don’t remember the details but we wrestled a lot with all this and what I remember is that it is far better practice to always set your servers in UTC.

What would be good to try is:

- Server in UTC
- Client in IST

and confirms that this works. Could you do that?

---

<div class="post-metadata">

### Author: ![nischith](https://talk.openmrs.org/user_avatar/talk.openmrs.org/nischith/32/13088_2.png) [@nischith](https://talk.openmrs.org/u/nischith)
#### Post date: [October 31, 2022, 9:12am UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/5 "2022-10-31T09:12:55Z")

</div>

The frontend being used here is the old RefApp distro (_Refapp 2.13.0_) and not the one of the Microfrontend architecture. So, here both the core and the related frontend modules are residing in the same machine.

The frontend/ client modules are in the _Modules_ directory of the same machine on which _OpenMRS Core_ has also been deployed. I am not quite sure if it is possible to have the frontend modules running on a separate machine configured to a different Timezone.

If there is any documentation detailing a different setup, I would be happy to implement that.

I am sorry if I am missing something here. Thanks!

---

<div class="post-metadata">

### Author: ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)
#### Post date: [October 31, 2022, 12:46pm UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/6 "2022-10-31T12:46:37Z")

</div>

@mksd Wasn’t this supposed to be an opt-in or opt-out feature? It looks like we might have inadvertently made it mandatory…

@nischith There’s a global property called “timezone.conversions”. Can you check what it’s set to on your setup? Also, are you able to reproduce the issue on [qa-refapp.openmrs.org](http://qa-refapp.openmrs.org)?

PS The “client” in question is your browser. While the MF architecture might be new, we’ve used Javascript-driven frontends… about as long as OpenMRS has been around.

---

<div class="post-metadata">

### Author: ![nischith](https://talk.openmrs.org/user_avatar/talk.openmrs.org/nischith/32/13088_2.png) [@nischith](https://talk.openmrs.org/u/nischith)
#### Post date: [October 31, 2022, 2:02pm UTC](https://talk.openmrs.org/t/encounterdate-of-html-form-shows-incorrect-time/37788/7 "2022-10-31T14:02:57Z")

</div>

@ibacher

The value of `timezone.conversions` is `false` on my setup

Also, I am able to reproduce the issue on [qa-refapp.openmrs.org](http://qa-refapp.openmrs.org/)

My local machine/ browser has always been configured to IST and in spite of that at [qa-refapp.openmrs.org](http://qa-refapp.openmrs.org/) and in the setup talked about in this topic, `<encounterDate>` displays the time in UTC. I have just created a form by the name `Test-form-Oct-2022` at [qa-refapp.openmrs.org](http://qa-refapp.openmrs.org/) to verify the same (visible at the patient dashboard, Current Visit Actions)

But, during the course of this chat it looks like a solution has been found (and hoping that it is a reliable one):

→ Initially the machine the webserver was running on was set to UTC and `<encounterDate>` also displayed the time in UTC

→ Next, the above machine’s Time zone was changed to IST but `<encounterDate>` continued to display the time in UTC

→ Finally, after restarting both the webserver and rebooting the machine `<encounterDate>` has started showing the time in IST

So, it _looks like_ `<encounterDate>` is tuned to the server time and not the client/ browser time.

Thanks!
