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

Change PatientState startDate and endDate to be LocalDate type



    • Story
    • Status: Design
    • TBD
    • Resolution: Unresolved
    • None
    • None
    • None
    • Undetermined


      Currently, the PatientState startDate and endDate are Date objects (ie, with a time and time zone component) in Java, although behind-the-scenes they are Date objects in MySQL (without time and time zone).

      This causes potential confusion across timezones, ie when a patient state startDate or endDate is requests via the REST API, the API returns a full string representation of that datetime, with a time set to "0:00:00", but, crucially, also with a time zone component.

      If the client machine is in a different timezone than the server, this could result in the date displayed on the client machine being different from the date on the server machine.

      In order to correct this, we should change the type of startDate and endDate on PatientState from Date to LocalDate (available in Java 8) which is meant to only represent a date without a time component and time zone.

      This will require some design for backwards compatibility, because we'd be changing the return type fo the getter for startDate and endDate.

      We'd also want to confirm during testing that the REST API properly converts a LocalDate into a date string without a time or timezone component.

      Gliffy Diagrams


          Issue Links



                Unassigned Unassigned
                mogoodrich Mark Goodrich
                0 Vote for this issue
                1 Start watching this issue