Hi Maddy
Did you tried using the time out option. Try tweaking around the time out value (here it is 200) and increase or decrease depends on the performance of your environment.
var isItemLocked = thisItem.isLocked();
var transfer_date = getFieldByName("transfer_date");
disableDateField = function() {
if(isItemLocked)
{
transfer_date.getElementsByTagName("input")[0].setAttribute("disabled", "");
transfer_date.getElementsByTagName("input")[1].setAttribute("disabled", "");
transfer_date.getElementsByTagName("input")[1].src = "../images/calendar-disabled.svg";
}};
setTimeout(disableDateField, 200);
It works well in my environment
Thank You
Gopi