Filling in "Reqd by Date" on PO Item with today

I created a custom script for PO Item, but it doesn’t set any value:

frappe.ui.form.on("Purchase Order Item", "onload", function(frm) { 

set it for “refresh” rather than “onload”

I changed it to refresh and I’m able to add an item and press DONE without filling the date field. The field is empty but mandatory, but the DONE button still works. Is the value being set but not displayed?