Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-755

<encounterDate> does not post time zone info to server




      1. Steps to reproduce

      In a nutshell here is what triggers the bug:

      1. Configure the client on a timezone ahead of the OpenMRS servers's timezone.
      2. Start a visit (that's just to stick to the form/encounter flow.)
      3. Submit a form and set the encounter's datetime to be the current time in the timezone ahead of the OpenMRS server's time.
      4. Observe that the encounter cannot be submitted with a "Cannot be in the future" error message.
      2. Detailed Steps to reproduce
      2.1. Sample form:
      <htmlform formUuid="cc0e4f09-6f03-437a-bb7c-59106b48eb8e" formName="Timezone Test" formEncounterType="67a71486-1a54-468f-ac3e-7091a9a79584" formVersion="1.0">
              .section {
                  border: 1px solid $headerColor;
                  padding: 2px;
                  text-align: left;
                  margin-bottom: 1em;
              .sectionHeader {
                  background-color: $headerColor;
                  color: $fontOnHeaderColor;
                  display: block;
                  padding: 2px;
                  font-weight: bold;
              table.baseline-aligned td {
                  vertical-align: baseline;
          <section headerLabel="Encounter Date/Time">
              <table class="baseline-aligned">
                      <td><encounterDate default="now" showTime="true"/></td>
      2.2. Save it as "Timezone Test":

      Under manage forms at /openmrs/module/htmlformentry/htmlForms.list.

      2.3. Add it to 'Patient Dashboard - Current Visit Actions':

      At /openmrs/formentryapp/forms.page?app=formentryapp.forms

      2.4. Set your browser to be on a timezone ahead:

      (In Google Chrome: )

      2.5. Fill the encounter datetime and submit:

      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.)

      2.6. Observe the issue:

      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.

      Gliffy Diagrams


          Issue Links



                jfigueiredo Joel Figueiredo
                mksd Dimitri R
                0 Vote for this issue
                6 Start watching this issue