Using the CustomTimePicker is there a way to set Min and Max Time

Hi, I'm using your CustomTimePicker. I have three columns Hours, Minutes and Format(AM/PM).

I'm struggling to create a min and max time with this control. I've thought about just making it Cascading. I want to set a starting time at 6AM and an ending time at 10PM.  


7 Replies 1 reply marked as answer

JK Jeya Kasipandi Syncfusion Team August 23, 2021 11:38 AM UTC

Hi Zain,

We suggest you populate the item collection as like below code snippet to set the minimum and maximum time in Picker. We have created sample based on this and please find the sample from below link

Code Snippet:

private void PopulateTimeCollection()
        {
            //Populate Hour
            for (int i = 6; i <= 10; i++)
            {
                Hour.Add(i.ToString());
            }

            //Populate Minute
            for (int j = 0; j < 60; j++)
            {
                if (j < 10)
                {
                    Minute.Add("0" + j);
                }
                else
                    Minute.Add(j.ToString());
            }

            //Populate Format
            Format.Add("AM");

            Format.Add("PM");
           
            Time.Add(Hour);
            Time.Add(Minute);
            Time.Add(Format);
        }

Sample Link:

Please check with the above and let us know if you have any concern.

Regards,
Jeya K



ZA Zain August 23, 2021 12:54 PM UTC

Hi, thanks for the help. It's not quite what I need, as this timer only allows me to choose a time from 6AM till 10AM then 6PM till 10PM. I would still like to be able to choose the time between 10AM till 6PM. Does that make sense? sorry for an inconvenience. Thanks 



JK Jeya Kasipandi Syncfusion Team August 24, 2021 07:31 AM UTC

Hi Zain,

We have validated your query and modified the sample based on this. Please find the sample from below link

Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TimePicker_(2)2113729116  

In sample, we have modified the item source collection and set the enable looping to true.

Please check with the above sample and if your requirement is different from this, can you please share more detailed information about your requirement such as a screen shot or a video ?. This will be helpful for us to provide an appropriate solution at earliest.

Regards,
Jeya K


ZA Zain August 24, 2021 09:42 AM UTC

Hi Jeya,


Thank you for your answer. I am actually developing an app for my store. With an operational time from 6AM till 10PM. I would like to modify the custom timepicker to only show my operational hours to my customers (6AM - 10PM) a min (6AM) and max (10PM) time. The code sample you supplied above allows the customer to choose all times of the day, thus showing them my non-operational time. Is it possible to modify the custom timepicker to my needs. Thanks



JK Jeya Kasipandi Syncfusion Team August 25, 2021 12:32 PM UTC

Hi Zain,

We have modified the sample based on your requirement and please find the sample from below link

Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TimePicker1985249133  

In this sample, we have changed the itemsource based on the Format (AM, PM) in selection changed event.

Please check with the above and let us know if you have any concern.

Regards,
Jeya K



Marked as answer

ZA Zain August 25, 2021 12:45 PM UTC

Thanks Jeya,


This is amazing. It was exactly what I was looking for. Thank you for your patience. 



JK Jeya Kasipandi Syncfusion Team August 26, 2021 06:12 AM UTC

Hi Zain,

Thanks for the update.

Please let us know if you have any other queries.

Regards,
Jeya K

Loader.
Up arrow icon