Date Time Picker Default Start Date/Time

I have a record where a power automate sets the date for the employee, and the employee selects the time in edit mode. Unfortunately, whenever they select the Date/Time picker, it defaults them back to the current date and mistakenly override the system set date with the current date. Is there a way to make the date/time picker default to the value that's already there, and not to the current date/time?

Hello @Jeremy_Springer,

How are users only allowed to choose the time? Do you have any code related to Date & Time field?

There's no code hiding the date. They can edit both date and time. That's part of the problem. The control automatically sets the date part of the field to the current date, rather than the date that's already in the record. If the user isn't paying attention, they can very easily replace the date in the record with the current date. This is causing a lot of data entry errors.

@Jeremy_Springer,

You can specify the minimum and maximum date, which a user can select using the code.

fd.spRendered(function() {
    var date = new Date(fd.field('DateTime').value)
    fd.field('DateTime').widgetOptions = {
        min: new Date(date.setHours(00,00,00)),
        max: new Date(date.setHours(23,59,59))
    }
});

Thus user can select only time for the specific date only.

That was the perfect solution! Thank you!

1 Like