V7.0.1 datetime issue

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?

hi @snailwell , does removing the if condition in the code you pointed to solve the issue?

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.

1 Like

Eeesh. I should sit down and see if I oughta upgrade that version of MySQL in there, but this sounds more like a MySQL/MariaDB conflict that might not help. May just need to ask for a patch.

Have a PR up and will get this fix into the 1st patch.

1 Like