ParseDateTimeValue problems

10 posts, 1 answers
  1. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 26 Oct 2010 Link to this post

    Hi!

    I'm having trouble with how the RadDateTimePicker parses the datetime string.
    I have the culture set to "sv-FI" and that culture has the following ShortDatePattern: "d.M.yyyy".
    The RadDateTimePicker's DisplayFormat is set to Short.

    I made two test's with two different dates and here are the results that was displayed in the ToolTip.

    Test 1:
    26 => 26.10.2010 (OK)

    26.1 => Error (Should have been 26.1.2010)
    26.10 => Error (Should have been 26.10.2010)

    26.10.2 => 26.10.2002 (OK, I think?)
    26.10.20 => 26.10.2020 (OK, I think?)
    26.10.201 => 26.10.0201 (not sure, maybe 26.10.2010 would have been better?)

    Test 2:
    4 => 4.10.2010 (OK)

    4.1 => 1.4.2010 (Not ok, turns day and month around!)
    4.10 => 10.4.2010 (Not ok, turns day and month around!)

    4.10.2 => 4.10.2002 (OK, I think?)
    4.10.20 => 4.10.2020 (OK, I think?)
    4.10.201 => 4.10.0201 (not sure, maybe 4.10.2010 would have been better?)

    I'm not sure about the result in some of the cases but at least when I entered d.M the parser shouldn't interpret it as M.d

    Can you help me please?

    Tomas

  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 28 Oct 2010 Link to this post

    Hi Tomas,

    I am sorry for the misleading caused. Let me explain the parsing logic. The DateTImePicker removes all of the unnecessary information. Then it passes to the DateTime.TryParse system function, where the final result comes from. In case you are not satisfied with the retrieve date, use the ParseDateTimeValue event. There you have an access to the current entered string and you can put the desired date in the args.Result argument. Let me know if my explanation is not clear enough.

    Best wishes,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 28 Oct 2010 Link to this post

    Hi Kaloyan,

    Thank you for your reply. However I'm still a little bit confused as of why the DateTimePicker removes information about the current culture's shortdate pattern because I don't think this is "unnecessary information". In my case as the shortdate pattern is "d.M.yyyy" I think the characters after the first dot should be treated as "month", but in the testcase I supplied 4.10 => 10.4.2010 the parser for some reason treats the characters after the first dot as day and the character before the first dot as month.

    Tomas

  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 03 Nov 2010 Link to this post

    Hello Tomas,

    The parser doesn't remove any information related to the date format. It is checking if some alphabetical symbols are at their places with the help of the regular expression and the result is passed to the DateTime.Parse function.

    Kind regards,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 03 Nov 2010 Link to this post

    Hi Kaloyan,

    So how would you solve my problem then? I understand that the logic has to support many different dateformats
    but in my opinion it's clearly something wrong here. As the regex is able to locate the different parts of the string it should then be possible to send the parts in correct order accoring to the culture's dateformat to the DateTime.Parse method don't you think? The string "03.11" (November 3rd) should by no means turn into March 11th 2010.

    Sorry for repeating myself over and over but I'm a little bit stuck right now.

    Tomas

  7. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 08 Nov 2010 Link to this post

    Hi,

    I have the same problem with dutch culture "nl-NL".
    Is there a solution or workaround?

    Kind Regards.
  8. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 09 Nov 2010 Link to this post

    Hello Henk,

    Thank you for the feedback and the suggestions. We will try to improve it in the next version of the control.

    Regards,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 14 Dec 2010 Link to this post

    Hi Kaloyan,

    I noticed something strange today. The parsing works as expected on my new Windows 7 machine. First I thought you had made some changes to the 2010 Q3 release. But then I started my old XP machine but there the problem still exists.

    So I did some testing and this is what I've found so far:
    Windows XP (32-bit) IE8 => not working
    Windows Vista (32-bit) IE8 => not working
    Windows 7 (64-bit) IE8 => working

    I'm not sure anymore if this is related to Telerik or if this is a problem in Silverlight.

    Henk can you please try on different Windows versions as well?

    Tomas
  10. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 15 Dec 2010 Link to this post

    Hello,

    I can now confirm the following:

    Windows Vista (32-bit) IE8 => not working

    I will try the other versions as well.
  11. Answer
    Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 20 Dec 2010 Link to this post

    Hello Guys,

    Thanks for reporting the issue. We were able to reproduce the problem. This is a very strange problem as the parser should not care of the OS. I have entered the bug in our PITS. You can follow its progress here: http://www.telerik.com/support/pits.aspx#/public/silverlight/4385

     Thank you once again for the cooperation. I have updated your telerik points.


    All the best,
    Boyan
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top
DevCraft banner