RE: lock and unlock the date and time data type
Hi ONENEXT,
You can use Business Rule to achieve this requirement as in the below screenshot.
If you still need javascript, below is the function which unlocks Departure Date when the Arrival Date is inserted. You can register this function on change of Arrival Date field and on form load. Also, lock the Departure Date field by default under form field properties.
function unlockDepartureDate() {
var arrivalDate = Xrm.Page.getAttribute("arrivalDateFieldName").getValue();
Xrm.Page.getControl("dipartureDateFieldName").setDisabled(arrivalDate == null);
}