I have a requirement I have datetime component user can select the time maximum 2 hours from their current time else there should be validation error , i want to show the current time defaulted in the time field and they should select the time upto 2 hours . It should be in est . Can anyone help me with this
Discussion posts and replies are publicly visible
Try this
a!localVariables( local!selectedTime: now(), a!dateTimeField( label: "Select Time (max 2h from now)", value: local!selectedTime, saveInto: local!selectedTime, validations: ( if( local!selectedTime > addhours(now(), 2), "Select time within 2 hours from current time", {} ) ) ) )
I suggest to use the a!addDateTime() function as it is included in the base product.