Make orders after 15:00 in next day

hello every one

please i need help to make sure that if the user try to make sales order after 15:00 the transaction date will be in next day

i tried this

frappe.ui.form.on("Sales Order", "onload", function(frm, cdt, cdn){
      var d = new Date();
      var n = d.toString();
      var h = n.substr(15, 6);
 if (h > "15:00") {        
		frm.set_value("transaction_date", frappe.datetime.add_days(frappe.datetime.nowdate(), 1));
    } 
})

but no luck!! whats wrong with it ??

i think using moment js lib which included in framework will help a lot in comparing …
any way i will try on the console this
cur_frm.set_value(“transaction_date”, frappe.datetime.add_days(frappe.datetime.nowdate(), 1));
and see if it changes ,
also if you are working with child table setting values is different way …
I’m more a backend than front end guy - for me i will think like that :
add a hook before insert on Doctype sales order …
so each time a sales order inserted to the system(by api or gui ) the function trigger from my custom app api.py
then in the custom method inside api.py … i will check the data and change the value of the object before inserted to database …
Hook.py(Before insert envent) ==> Api.py (Custom app include api.py file ) ===> check_date_so(method to do the logic which takes doc and method as parameters from the hook calling it ) and you can do whatever you like with sales order object …

done by that way

frappe.ui.form.on(“Sales Order”, “onload”, function(frm, cdt, cdn){
if (moment().format(‘HH:MM’) > ‘15:00’) {
frm.set_value(“transaction_date”, frappe.datetime.add_days(frappe.datetime.nowdate(), 1));
}
})