'How can I restrict minimum and maximum hours in a datetime field in Dynamics 365 on-premise?
I need to limit the visible hours in datepicker. I tried the code below but it did not work:
var iframe = document.getElementById("contentIFrame0");
var elmnt = iframe.contentWindow.document.getElementById("new_starttime_iTime.00:00")[0];
elmnt.style.display = "none";
Is there an attribute like minHour, maxHour that I can reach using:
Xrm.Page.getControl("new_starttime").minHour = 9
Solution 1:[1]
This can not be done using the regular datepicker control. Also, fiddling with the HTML is not supported and/or recommended.
Instead you could consider developing a custom PCF control. Building it from scratch is not necessary. There are plenty open source examples available. Check out the PCF Gallery for example.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Henk van Boeijen |