In a nutshell here is what triggers the bug:
- Configure the client on a timezone ahead of the OpenMRS servers's timezone.
- Start a visit (that's just to stick to the form/encounter flow.)
- Submit a form and set the encounter's datetime to be the current time in the timezone ahead of the OpenMRS server's time.
- Observe that the encounter cannot be submitted with a "Cannot be in the future" error message.
Under manage forms at /openmrs/module/htmlformentry/htmlForms.list.
(In Google Chrome: )
Being on the timezone ahead, you would pick a later time than the "now" suggested by the form. The "now" being actually the server time (yet again here, and that's another bug, not adjusted to be on the client's timezone.)
Because the client is being shifted to be on a timezone ahead of the server time, it should be ok to submit a time that is ahead in accordance to the time difference.
The timezone info should be posted as part of the specified encounter datetime and the server should adjust the received encounter datetime to be offset as per the timezone info that is embedded. However this doesn't happen and the encounter datetime is being seen by the server as being in the future, causing the error.
- The server time is 07.00.
- The client's time is 3h ahead, so 10.00.
- (The visit start time is 06.30.)
- Submitting and encounter time of 10.00 (or 10.00Z+3 in pseudo code) should result in a server time of 07.00 after offsetting the timezone.
- However, the server does receive an unadjusted encounter time of 10.00 ahead of its time (07.00), producing the error message.