Encounter datetime should be after the visit start date

Application Name: OpenMRS 2.5 Standalone – openSUSE Tumbleweed Version Number: 2.5

Question: Hello. Would you please help me with the following problem. I am trying to record some vital parameters in OpenMRS 2.5 Standalone. To achieve this, I login as a doctor in an outpatient clinic (using a preset account), open a visit for an existing (preset) patient and chose ‘Capture vitals’. However, when I try to save the vitals, I obtain the following message: “Encounter datetime should be after the visit start date”. As a result, I can not save the vitals, and diagnosis, etc. What am I doing wrong? Thank you!

Are you able to reproduce it here? qa-refapp.openmrs.org

Dear Daniel, I am not able to reproduce it. Everything works fine at the link you have provided.

Are you able to locally reproduce the problem for another patient?

Yes, absolutely. For every patient in presets and every newly created patient.

Can you paste the contents of the tomcat log at pastebin.com? The log file is in tomcat/logs

It is too large for a pastebin, so I uploaded it here: https://www.upload.ee/files/6614619/2017-1-28.log.html

The log is available at pastebin.com/8dB8MRka

By chance, did the timezone on your machine change recently? it is s Linux machine, and, if so, what is the content of your /etc/timezone file.

We’ve had issues with time zones that have “SystemV” in them, which seems to be an old, legacy timezone type, but which has been showing up for us after some updates of the tzdata app and has been resulting in the exact error you are seeing.

Take care, Mark

Dear Mark, here are the timezones on my openSUSE system:

mainframe:~ # readlink -f /etc/localtime 
mainframe:~ # cat /etc/sysconfig/clock

They were not changed recently. However, I feel there may be something related here. Please see the screenshot of the Visits menu.

Is it OK that when I start the visit on 30.01.2017, the date on the left reads as 29.01.17?

No, that’s not okay… it appears that different parts of the code are interpreting the time zone in different ways, and so you are getting an error when it tries to save an encounter for Jan 29th on a visit that started Jan 30th.

Unclear exactly why this is happening, but looking at what functions these two display elements use to render the time might give you some help.

Take care, Mark

I see. Hope the developers will pay some attention to the issue. It is a stopper bug for me. Btw, the time on the left is always 23:00:00. Apparently, no reading of the current time is performed at all.

@jackgin if you start a new visit right now for another patient, on the 30.01.2017, does the date on the left still read as 29.01.17?

@dkayiwa yes, it does.

Just to refine this, regardless of the time when you start the visit, the left hand side always has the time as 23:00:00?

Another question, did you modify any modules? Am asking because i have just tried a fresh standalone installation and it does not include time at the place where you have 23:00:00

The time is always 23:00:00, though the date changes, always lagging one day behind the current date. I did not change any modules. The problem exists from the very start on a clean install. Several times I deleted the whole directory and performed a clean install only to face the same problem again. It might be relevant to mention the java version installed: mainframe:~> rpm -q java-1_8_0-openjdk java-1_8_0-openjdk-

Just tried a clean install with Oracle Java. Same problem.

@jackgin since i have not been able to reproduce this locally, it is going to require lots of back and forth. When can you get some time to come on the OpenMRS IRC channel and we interactively look into this?

@dkayiwa Already there