How can a datepicker have a time set to 23:59 automatically?

0
I'm building the function where teachers can create homework for students. From a student perspective, I want to be able to see what time the deadline is.  From my own experience, this was most often "By end of day", i.e. 23:59, unless otherwise specified.  The current datepicker always specifies 12:00AM as a default time and, as far as I can tell, only be hand-typed editted.  I want to have the functionality to have the time be set to 23:59 automatically, once a date has been picked. How?
asked
4 answers
7

Hi Sander,

Of course there are various nice widgets available for time entry, but if you want users to only set a date and change the time yourself, you can always do this in your 'Save' microflow. You can use addMinutes(addDays(trimToDays($value), 1),-1) for instance.

answered
1

Hi Sander,

 

You can use a on change microflow on the datepicker, or change this in the save microflow. 

addMinutes(addHours(trimToDays($Object/EndDateTime),23),59)

If you also provide a different object for entering the end time you can do the following:

addMinutes(addHours(trimToDays($Object/EndDateTime), parseInteger(formatDateTime($Object/EndTime, 'HH'))),parseInteger(formatDateTime($Object/EndTime, 'mm')))

Hope this will help you.

 

Good luck

answered
1

Hnn, I would use the addMilliseconds instead of addMinutes if want to record the end of day. You otherwise might run into problems when comparing this date with other [%EndOfCurrentDay%] checks. 

Regards,

Ronald

answered
0

If you want to allow a user to set different times you can use this widget to set the time portion of the date/time attribute

https://appstore.home.mendix.com/link/app/2721/AuraQ-Limited/Clockpicker-widget

answered