Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: DateTimePicker resets date part to today on time changing when TimeFormatString="HHmm" [22170]

$
0
0
We are using military time format (HHmm) in our application and have faced with following bug.
We have fixed it by inheriting TimePicker as follows

public class TimePickerEx : TimePicker
{
protected override DateTime? ConvertTextToValue(string text)
{
// Fixed problem with incorrect parsing text with HHmm format
DateTime? result = base.ConvertTextToValue(text);
if (Value != null && result != null && Value.Value.Date != result.Value.Date)
{
result = Value.Value.Date.Add(result.Value.Subtract(result.Value.Date));
}
return result;
}
}

and using new TimePickerEx in control template of DateTimePicker

but it would be nice if you fix this problem in original TimePicker.
More deep investigation shows that problem is with DateTimeParser which internally is used in ConvertTextToValue, the parser parse text with HHmm format incorrectly.
Comments: ** Comment from web user: BoucherS **

hI,

This is happening because there is no known time separator. Usual time separators are :
```
" "
", "
"-"
"_"
"."
"/"
":"
```
We will look into this.
Thanks.


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>