Problem with RadDatePicker control - Cannot select 01/10/2009

17 posts, 0 answers
  1. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 19 Oct 2009 Link to this post

    We are experiencing an issue with the RadDatePicker control.

    Whenever we select (or enter) the date "01/01/2009", the control sets the date to "31/01/2008". This behaviour occurs on the Telerik demo page.

    Our SOE is Windows XP SP3 (Australia, en-AU) & IE7 (Firefox 3.5.3 also behaves incorrectly).

    I have tried on another non-SOE machine running Windows XP SP2 (Australia, en-AU) & IE6 / Firefox 3.0, and this one behaves correctly.

    Any ideas?

    Thanks
    Matthew
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 21 Oct 2009 Link to this post

    Hello Matthew,

    I tried to reproduce the issue on this online demo of the product under IE 7/FF 3.x and Windows XP SP3, applying the specified Australian culture, but unfortunately to no avail. Can you please verify the correct behavior on your machine? Let me know if I am leaving something out.

    Kind regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 21 Oct 2009 Link to this post

    I confirm that the demo page you specified does NOT work for 1/1/2009 on any of our customer's workstations. I've tested at least 3 different machines.

    I've attached screenshots demonstrating the problem.

    1. Type in 1/1/2009
    2. Tab away from the field
    3. Datepicker changes to 31/1/2008

    The problem occurs regardless of whether I type it in using the keyboard, or select it from the picker using the mouse.

    I can set the value "1/1/2009" programatically, but as soon as the field receives focus, the date reverts to "31/1/2008".
  4. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 21 Oct 2009 Link to this post

    Screenshots
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Oct 2009 Link to this post

    Hello Matthew,

    I followed the set of steps you specified (choosing Australian culture beforehand) but the result was the same as before. Let me know if you would like to prepare a short video for you illustrating what I did with the configuration on the online demo.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 23 Oct 2009 Link to this post

    Edited. See below.
  7. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 23 Oct 2009 Link to this post

    Ok, it appears that this issue is related to daylight savings.
    The problem code is located within the RadDateInputScript.js file.

    GetDate: function(_24, _25) {  
            console.log('GetDate: IN=' + _24 + ', ' + _25);       
            var _26 = DateEntry.CloneDate(_25);       
            this.Distribute(_24);  
            if (this.NumericSpecialCase(_24)) {  
                throw new DateParseException();  
            }  
            var _27 = this.GetYear();  
            if (_27 != null) {  
                _26.setFullYear(_27);  
            }  
            var _28 = this.GetMonth();  
            if (_28 != null) {  
                this.SetMonth(_26, _28);  
            }          
            var day = this.GetDay();  
            if (day != null) {  
                this.SetDay(_26, day);  
            }         
            console.log('GetDate: OUT=' + _26);       
            return _26;  
        } 

    When my timezone is set to "W. Australia Standard Time" WITH daylight savings selected, this function behaves as follows.
    GetDate: IN=1,1,2009, Fri Oct 23 2009 00:00:00 GMT+0800  
    GetDate: OUT=Thu Jan 31 2008 23:00:00 GMT+0900 

    When my timezone is set to "W. Australia Standard Time" WITHOUT daylight savings selected, this function behaves as follows.
    GetDate: IN=1,1,2009, Fri Oct 23 2009 00:00:00 GMT+0800  
    GetDate: OUT=Thu Jan 01 2009 00:00:00 GMT+0800 

    Is this a bug?
  8. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 23 Oct 2009 Link to this post

    Hello Matthew,

    This is not a bug in RadDateInput,  but a behavior in the built-in Javascript Date object. Using the same time zone, try setting a new Date object and then alert it, like this:

    var d = new Date("1/1/2009");
    alert(d);


    Chances are, you are going to get Wed Dec 31 2008 23:00:00

    What happens is that when daylight saving is turned on, the Date objects turns the date 1 hour back. If you want to select the earliest date and time on January 1, 2009, you need to create a Date object with a time of 01:00:00:

    var d = new Date("1/1/2009 01:00:00");
    alert(d);

    Output: Thu Jan 1 2009 01:00:00

    I believe the problem you are experiencing is closely to this. On the other hand, I cannot reproduce this behavior neither in WinXP SP2  nor in SP3 with Australian time zone (+8 Perth). Can you give any further instructions?

    Sincerely yours,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 25 Oct 2009 Link to this post

    Here's what I've found out.

    Adjust for DST ON
    var d = new Date("1/1/2009");
    Result = Wed Dec 31 23:00:00 UTC +0800 2008

    var d = new Date("12/31/2008");
    Result = Wed Dec 31 00:00:00 UTC +0800 2008

    var d = new Date("1/2/2009");
    Result = Fri Jan 2 00:00:00 UTC +0900 2009

    var d = new Date("1/1/2009 00:59:00");
    Result = Wed Dec 31 23:59:00 UTC +0800 2008

    var d = new Date("1/1/2009 01:00:00");
    Result = Thu Jan 1 01:00:00 UTC +0900 2009

    Adjust for DST OFF
    var d = new Date("1/1/2009");
    Result = Thu Jan 1 00:00:00 UTC +0800 2009

    var d = new Date("12/31/2008");
    Result = Wed Dec 31 00:00:00 UTC +0800 2008

    var d = new Date("1/2/2009");
    Result = Fri Jan 2 00:00:00 UTC +0800 2009

    var d = new Date("1/1/2009 00:59:00");
    Result = Thu Jan 1 00:59:00 UTC +0800 2009

    var d = new Date("1/1/2009 01:00:00");
    Result = Thu Jan 1 01:00:00 UTC +0800 2009

    1. Javascript adjusts dates for daylight savings time. I would not have expected this behaviour. If I create a date object with "1/1/2009", I expect it to maintain this value.

    2. Out customer has incorrectly configured daylight savings to start on 1/1 at 12am. This is the reason why 1/1/2009 causes us problems. I have updated the daylight savings settings on my local machine to start in October at 2am, and everything appears to function correctly.

    3. I still believe there is a bug in the telerik datepicker in the case where daylight savings starts at 1/1 at 12am. If I type 1/1/2009 into the RadDatePicker control, I expect 1/1/2009 to be displayed. If for some reason, the date is adjusted for DST (which it shouldn't be), it should display 31/12/2008 rather than 31/1/2008.

    For now, I think we can work around any issues by correcting the DST settings on the workstations.

    Thanks for your help.
    Matt
  10. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 26 Oct 2009 Link to this post

    Hi Matthew,

    You are right about the javascript Date object adjusting the time. As for the issue where selecting 31/12/2008 turns to 31/01/2008, I still cannot reproduce this. If you can give me exact steps to reproduce + date&time settings needed, I can further investigate if this is a RadDatePicker bug or not.

    Kind regards,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 27 Oct 2009 Link to this post

    Steps to reproduce:

    1. Using the TZEdit utility from Microsoft, configure the "(GMT +8.00) Perth" timezone to start daylight savings at 12am on 1-Jan.

    2. Using the Windows Date & Time Properties dialog, select the "(GMT +8.00) Perth" timezone, and ensure that "Automatically adjust clock for daylight saving changes" is selected.

    3. Load the Telerik DatePicker demo app, and try to enter 1/1/2009.
  12. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 27 Oct 2009 Link to this post

    Hello Matthew,

    I downloaded some program named Windows Time Zone editor (tzedit), but it does not give me exact dates for changing the DST. It's got First/Last Monday/Sunday of ... - style of DST selection. Is it the same tool you are using? If yes, what exactly do you set?

    Regards,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  13. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 27 Oct 2009 Link to this post

    Here's the configuration.
  14. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 28 Oct 2009 Link to this post

    Hello Matthew,

    Still nothing. Attaching a video.

    Best wishes,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  15. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 28 Oct 2009 Link to this post

    You need to set the start time for daylight savings to 12am (rather than 12pm as shown in the video).
  16. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 29 Oct 2009 Link to this post

    Hello Matthew,

    I do, but once I close the form and re-open it, the time has been reverted back to PM. :(

    Regards,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  17. Matthew Mckenna
    Matthew Mckenna avatar
    10 posts
    Member since:
    Oct 2009

    Posted 01 Nov 2009 Link to this post

    Sorry you cannot reproduce the problem.

    The problem no longer affects us as the customer has corrected their daylight savings settings.

    Thanks for your help.
Back to Top