We'd like improve the EncounterForm to handle supporting recording the time of an encounter as part of the encounter datetime.
Currently, if no encounter date widget is on a form, the Encounter Form will not submit a encounter date and therefore behind-the-scenes the encounter datetime will be set to the current timestamp (this is the preferrred behavior).
However, if an encounter date widget is included on the page, things become more complicated. The encounter date widget only captures the date component of a widget, and in the retrospective use case we simple want to capture the date (and set the time to 00:00:00). However, when we are operating in a POC setting we'd like to be able define our forms to include the current time in the encounter_datetime.
To do this, we should do the follow:
- Add a new "timestampNewEncounterIfCurrentDay" prop to the EncounterForm with a default value of false
- If this new prop is explicility set to true, then when submitting a form that creates a new encounter, if the date selected in the encounter date widget is the current day, then send the current timestamp to the server.
- When editing an encounter, if the date component of the encounter datetime has not changed, do not update the encounter datetime (ie, when editing an existing form the time component should only be cleared out if the user explicitedly changes the date on the form)