We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TimeSpanEdit with hour-values greater than 24?

Hi,

does anyone know a way to get the TimeSpanEdit accepting inputs for hours greater than 24?

Use case:A testbench is calculating idle times (in minutes) which are assigned to a cause manually. E.g. 31:25 (hours:minutes) for case "user absent".

The standard behaviour of the control when you enter 31 hours is to show the difference to 24. For example if you enter 31 hours and the controls will show 7. (31-24).

To enter the day like 1.07:25 is not an option.

Thanks in adavnce for your suggestions!

Best regards!

Martin

4 Replies

KP Kanniyappan Panneer Selvam Syncfusion Team January 14, 2020 02:37 AM

Hi Martin Hagenow 
 
Thanks for contacting Syncfusion support.

We are currently validating your query and updating the further details on 20th January 2020. 
 
We appreciate your patience until then. 

Regards, 
Kanniyappan P 



NK Niranjan Kumar Gopalan Syncfusion Team January 20, 2020 08:49 AM

Hi Martin, 
 

We have checked your query “ Need to get the TimeSpanEdit accepting inputs for hours greater than 24”. We have created a work around solution to meet your criteria when the format is “hh:mm:ss”. Please refer the below sample and code snippet for same. This solution works properly for hour format alone (i.e . when format contains day and when you enter 48 value in hours, the day value will not update). Please let us know if the provided solution has satisfied your criteria.

XAML:

<syncfusion:TimeSpanEdit  Grid.Row="0" Name="myTimeSpanEdit"  Height="23"  Width="180"                                             Format="hh:mm:ss" Value="12:10:25"  ValueChanged="myTimeSpanEdit_ValueChanged" >            </syncfusion:TimeSpanEdit>

C#:

private void myTimeSpanEdit_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

        {

            if ((int)TimeSpan.Parse(e.NewValue.ToString()).TotalHours > 24)

            {

                int hour = (int)TimeSpan.Parse(e.NewValue.ToString()).TotalHours % 24;

                (d as TimeSpanEdit).Value = new TimeSpan(hour, (d as TimeSpanEdit).Value.Value.Minutes, (d as TimeSpanEdit).Value.Value.Seconds);

            }

        }

Sample link:   https://www.syncfusion.com/downloads/support/forum/150593/ze/CS1370601099

 
Regards, 
Niranjan Kumar 



MH Martin Hagenow January 21, 2020 04:51 AM

Perfect!

Many Thanks!

Regards,

Martin


NK Niranjan Kumar Gopalan Syncfusion Team January 21, 2020 10:30 AM

Hi Martin, 
 
Thanks for your update. 
 
Please let us know if you have further queries. We will be happy to assist you. 
 
Regards, 
Niranjan Kumar 
 


Loader.
Live Chat Icon For mobile
Up arrow icon