When creating a new encounter in v7.0.1, this code ensures that for any service date with a ‘pm’ suffix, the time will be formatted correctly, e.g. '17:45:00'. However, if the service date has an ‘am’ suffix, the time will remain unformatted and will be inserted into the database as such, e.g. '2023-05-05 11:00 am'.
This issue is not reproducible on the demo I suspect because the mariadb:10.11 image can handle datetime input such as '2023-05-05 11:00 am'. However, the mysql-xtrabackup:latest image used in the AWS packages (and probably older mariadb versions as well) cannot, and will produce an error like ERROR 1292 (22007): Incorrect datetime value: '2023-05-05 11:00 am' for column 'date' at row 1 upon insert.
This could partially explain these issues:
@jesdynf , can you check for this in the AWS mysql-xtrabackup image? @stephenwaite , can the time formatting code be standardized for all input?
Yes, without the ‘if’ condition it works for me with both ‘am’ and ‘pm’ for both date of service and onset date when creating a new encounter. Using the current mysql-xtrabackup:latest image as datastore.