Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4569

Calculated autoexpire date should be one second earlier

    XMLWordPrintable

    Details

    • Complexity:
      Low

      Description

      The code in org.openmrs.SimpleDosingInstructions#getAutoExpireDate does aMomentBefore(...).

      The "aMomentBefore" code subtracts one millisecond, however MySQL dates are only accurate to the second, therefore when this is actually written to the database, the aMomentBefore function has had no effect.

      E.g. I just created a drug order with date_activated = 2015-01-05 10:24:30 and duration of 7 days, so the auto_expire_date was calculated to 2015-01-12 10:24:30.

      I believe the fix is to change the aMomentBefore function to subtract 1s instead of 1ms.

      (Because of TRUNK-4252 I have a Hibernate interceptor running that plays around with dates, so there's a small possibility that the behavior I'm seeing is related to that.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tharunya Tharunya Pati
              Reporter:
              darius Darius Jazayeri [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: