DateTimePicker issue with DD/MM/YYYY

0
0

I have found an issue in date time picker when you change the customformat to be dd/mm/yyyy that when you go tot he text box if you click in the text box and change the date to be say 23/8/2017 every thing works great but if you change it to be say 1/9/2017 it will flip the date to be 9/1/2017 changing the month to January this happens when setting any of the days as 1 – 12, however it seems to work just fine if you use the calendar icon and pick from the calendar directly everything works just fine this issue only comes up when you manually enter in the date. any ideas on how to fix this or should i just make it so you can no longer manually enter in dates?

  • You must to post comments
0
0

Hi David,

we have logged this issue as WJ-8412 and it is fixed in Wisej 1.4.20

Best regards
Frank

  • You must to post comments
0
0

Thank, will be fixed in 1.4.

I have attached a MyDateTimePicker.cs class that you can use as a temporary fix. Actually with this class you can override the parsing to fit your app.

The problem is that DateTimePicker tries to be a bit lax with the parsing of custom formats and uses, in this order, this list “d”, “D”, “T”, “t”, Custom. So when the string fits the system’s formats it’s a match before the custom format.

The correct way to do this is to force the text to match the custom format, when defined, and don’t try to match the system formats at all.

 

  • Luca (ITG)
    One more thing, once fixed if you use “dd/MM/yyyy” then entering “1/8/2017” will fail, you will have to enter “01/08/2017”. Using “d/M/yyyy” instead allows for single and double digit day and month.
  • David Workman
    as always thanks Luca
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.