<encounterDate> of HTML Form shows incorrect time

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!

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

@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!

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?

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!

@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?

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.

@ibacher

The value of timezone.conversions is false on my setup

Also, I am able to reproduce the issue on qa-refapp.openmrs.org

My local machine/ browser has always been configured to IST and in spite of that at 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 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!