Date Control issue.

Posted by: mayur.purandare on 27 July 2020, 9:14 pm EST

  • Posted 27 July 2020, 9:14 pm EST

    Set Date as : 2-08-2020 and select Tab or move to any other control.

    After selection of tab button or cursor move, date is automatically changed to 08-02-2020.
  • Replied 28 July 2020, 9:26 pm EST

    Hi Mayur,

    I am not sure which control you are using, so I am taking C1DatePicker as reference for discussion. If you are using any other control or using C1DatePicker inside another control then please specify.

    To replicate the posted issue, we tested C1DatePicker with default values to all properties but could not see the behavior you mention. See attached video of the default C1DatePicker.

    Therefore, in order for us to assist you, please share more details about your usage of the control.

  • Replied 28 July 2020, 11:00 pm EST

    Dear Team,

    I am keeping my date format as dd/mm/yyyy. and when I edit it as 02/3/2020 it becomes 03/02/2020.

    I have attached sample solution also for this issue.
  • Replied 28 July 2020, 11:44 pm EST

  • Replied 29 July 2020, 6:09 pm EST

    Hi Mayur,

    Got it, thanks.
    The behavior you are observing could be because of incompatibility with the CurrentCulture.
    C1DatePicker uses CurrentCulture to convert value to string. If CurrentCulture uses date format incompatible with the CustomFormat, you can see such issues. I suggest to check what is the actual value of the CurrentThread.CurrentCulture and set it to something appropriate for the specified format.
    All the ComponentOne controls honor the FrameworkElement.Language property value. If it is not set, controls will use the default culture "en-US".
    Also, if your application explicitly sets Thread.CurrentThread.CurrentCulture property value, make sure that you set Language property for the root visual in your application to the same value

    For details you can read carefully the readme for build 271:

    Also, refer the following post:

    With regards,
  • Replied 30 July 2020, 10:00 pm EST

    Dear Team,

    I have shared the sample application. If you can check the code, I am not changing any default culture only I want my date format as dd:mm:yyyy.

    Please check the sample provided I have not changed the culture still it changes from 02/3/2020 it becomes 03/02/2020.
  • Replied 4 August 2020, 12:08 am EST

    Hi Mayur,

    As I see that you are providing a custom format for Date i.e "dd/MM/yyyy". Therefore the date 02/3/2020 is not valid as per this custom format and during validation it will be considered as "MM/d/yyyy" by the .Net Framework and hence the behavior.

    However if you want to use the month with/without zeroes you can use dd/M/yyyy format.

    I hope it helped.

  • Replied 4 August 2020, 6:46 pm EST

    Dear Team,

    If I used the format as dd/m/yyyy

    1. While displaying it will display 02/3/2020 where as my app needs the format as dd/mm/yyyy.

    2. Now if kept the format as dd/m/yyyy and displayed date is 03/9/2020 now if I edit the date as 2/9/2020 then also it changes to 09/2/2020 which is not correct.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels