This is a migrated thread and some comments may be shown as answers.

Elegant solution for RadDateTimePickers?

1 Answer 55 Views
Input
This is a migrated thread and some comments may be shown as answers.
TonyG
Top achievements
Rank 1
TonyG asked on 12 Dec 2013, 09:08 PM
I have an app where the user selects a From Date/Time and a To Date/Time. The default time on the End needs to be 23:59. Consider that if the user selects the same date in both controls that they intend to mean the entire day, not 12am to 12am of the same day. And it's a bit much to ask them to select the next day so that they get 12am of the next day.

So we're looking for a default of:
From 12/12/2013 00:00 to 12/12/2013 23:59

How do I set that? For the RadDateTimePicker, if I use markup to set the DateInput SelectedDate to "23:59", assuming the current date will get substituted, it still defaults to current date 00:00. Anything I set there is not used, like SelectedDate="01/01/2014 06:00AM". I know the default value for DateInput is MinDate, but I don't want to set a MinDate of "from date 23:59" because that will preclude setting to an earlier time of day.

Also, assume the user selects 21:00 but then they really want to change it to "end of day". Do I need to create a custom list in the TimeView which will allow them to select various times, including a final 23:59?

Rather than trying to accommodate such nuances, I'm wondering if there is a better solution. For example, I can code some post-processing logic that says "if the start and end-time are both 00:00 of the same day, then make the To time 23:59" for subsequent queries, or we can simply not use the time component if the date and tie are the same and the time is 00:00.

Thanks for your consideration. And I hope this help someone else who is working out a From/To scenario.

1 Answer, 1 is accepted

Sort by
0
TonyG
Top achievements
Rank 1
answered on 17 Dec 2013, 07:37 AM
This code sample seems to be the solution:

Tags
Input
Asked by
TonyG
Top achievements
Rank 1
Answers by
TonyG
Top achievements
Rank 1
Share this question
or