Error on date components

6 posts, 0 answers
  1. Peter Bezolucci
    Peter Bezolucci avatar
    6 posts
    Member since:
    Oct 2005

    Posted 02 Nov 2011 Link to this post

    I found a problem with the date components for some reason the system will never accept that I enter a date of any first Sunday after the 15th of the month of October every year.

    When I enter one of these dates and move the focus out of the component, the system automatically switches to the previous day.

    You can notice the issue even in the pages of the demonstration site:
    RadDatePicker
    http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/custompopup/defaultcs.aspx

    RadDateInput
    http://demos.telerik.com/aspnet-ajax/input/examples/raddateinput/firstlook/defaultcs.aspx

    Calendar / Range Selection
    http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/rangeselection/defaultcs.aspx

    Dates with problems:
    10/19/2014
    10/20/2013
    10/21/2012
    10/16/2011
    10/17/2010
    10/18/2009
    10/19/2008
    10/21/2007
    10/22/2006
    10/16/2005
    10/17/2004
    10/19/2003
    10/20/2002
    10/21/2001
    10/22/2000
    10/17/1999
    10/18/1998
    10/19/1997
    10/20/1996
    10/22/1995
    10/16/1994
    10/17/1993
    10/18/1992
    10/20/1991
    10/21/1990
    10/22/1989
    10/16/1988
    10/18/1987
    10/19/1986
    10/20/1985
    10/21/1984
    10/16/1983
    10/17/1982
    10/18/1981
    10/19/1980

  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 03 Nov 2011 Link to this post

    Hello Peter,

    The problem comes because of the Daylight saving time change in this dates.
    In some countries the clock is moving forward with one hour (or even 1.5 or 2 hours). So for example the "October 16 2011 00:00:00 AM" does not exist as valid time.

    For example if you are in Brazil:
    In 15 october you use GMT+2 time, and the first moment the time is:
    11:59:59 PM on October 15 with no DST (UTC-3h)

    And one moment later it gets:
    October 16 1:00:00 AM  with DST +1h (UTC-2h)

    And since the October 16 00:00:00 AM +1h does not exist(is not valid time), you can't select it in the DatePicker. The DatePicker itself selects the date with 00:00 hour.

    You could manually change the selected time with one hour to 1 AM if you like. For example you could use this code:
    <script type="text/javascript">
      function valueChanging(sender, args)
      {
        if (args.get_newValue() == "10/16/2011")
        {
          // 10/16/2011 for the given timezone will be auto-corrected to 10/15/2011 11:00 PM
          // Then in DateInput only 10/15/2011 will be shown, so change it to 10/16/2011 01:00 AM to be parsed as 10/16/2011
      
          //if you use DateTimePicker in the if statement check for "10/15/2011 11:00 PM"
      
          args.set_newValue("10/16/2011 01:00 AM");
        }
      }
      
    </script>
    <telerik:RadDatePicker runat="server" DateInput-ClientEvents-OnValueChanging="valueChanging">
    </telerik:RadDatePicker>

    Please not that the code-above currently will not work, and will work properly for the next release. There was a bug in the DatePicker/DateTimePicker that was causing even 10/16/2011 01:00 AM to be parsed as 10/15/2011, because the date and time is parsed separately by design. The fix will be included in the next release, and you would be able to select the date properly.

    Best wishes,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter Bezolucci
    Peter Bezolucci avatar
    6 posts
    Member since:
    Oct 2005

    Posted 06 Nov 2011 Link to this post

    Hello Vasin !

    In case of using RadDateInput or RadDatePicker for a date of birth on one form registration, anyone born in one of these dates would have problems to properly inform the correct day unless the javascript code takes care of the whole possible range of dates.
    (args.get_newValue() == "10/16/2011") ||
    (args.get_newValue() == "10/17/2010") ||
    (args.get_newValue() == "10/18/2009") ||
    (args.get_newValue() == "10/19/2008") ||
    (args.get_newValue() == "10/21/2007") ||
    (args.get_newValue() == "10/22/2006") || ...

    Is that right ?

    Best wishes,
    Peter
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 07 Nov 2011 Link to this post

    Hi Peter Bezolucci,

    If you use the picker for "date of birth" you probably don't need the time so you could modify it like:
    args.set_newValue(args.get_newValue() + "02:00 AM");

    Regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Peter Bezolucci
    Peter Bezolucci avatar
    6 posts
    Member since:
    Oct 2005

    Posted 15 Nov 2011 Link to this post

    Hello Vasil !
    Is there any chance to have a property like this?
    UseDaylightSaving = "False"

    Best Regards,
    -Peter
  7. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Nov 2011 Link to this post

    Hello Peter,

    I also do really think that such a property would be useful, but we are limited from the JavaScript Date object itself. The Date object does not have a way to turn off the DaylightSaving correction. In the same time is out of the control scope to know which country when changes it time to make a reverse correction if such property is set.

    Greetings,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017