Healthcare: Patient_appointment

The below error is show due to date conversion

Traceback (most recent call last):

  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 102, in execute_job
    method(**kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py", line 333, in set_appointment_reminder
    remind_before = datetime.datetime.strptime(frappe.db.get_single_value("Healthcare Settings", "rem_before"), '%H:%M:%S')
  File "/usr/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib/python3.6/_strptime.py", line 365, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains: .909578


Why not convert to 
datetime.datetime.strptime(frappe.db.get_single_value('Healthcare Settings','rem_before'),'%H:%M:%S.%f').strftime('%H:%M:%S')

Care to share version, steps to reproduce?

ERPNext: v12.14.0 (version-12)

Frappe Framework: v12.12.0 (version-12)

No steps to reproduce as this runs on the background tasks… But if you have health care domain active and try on console
datetime.datetime.strptime(frappe.db.get_single_value(“Healthcare Settings”, “rem_before”), ‘%H:%M:%S’)
It will return the error if field rem_before has a time with nanoseconds.

@Helio_Jesus By default, Remind before needs time in %H:%M:%S. So if you set time in this format, it should work.

Any reason why you are setting nanoseconds in the time format?

When you enable it this is how it looks
image

If user does not change and assuming user will not see the Nanoseconds… the error will be created on the background…

Which version of ERPNext are you using? @Helio_Jesus

On the latest version, when it is enabled, nano seconds are not being added.

I am still on V12
Only next year will move to V13.