Make or Convert input in Datafiled in Sentence Case - Pls Point out any Script

I want to make data filed input in sentence case like

ram narayan to Ram Narayan

I could not get any discussion about this, Please point of any hint to achieve the same by server script or client script

used server script like

if doc.first_name is not None:
doc.first_name = doc.first_name.upper()

and client script

frappe.ui.form.on(“Patient”, “first_name”, function(frm){
frm.set_value(“first_name”, frm.doc.first_name.toUpperCase() )