This is a migrated thread and some comments may be shown as answers.

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

16 Answers 294 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Matthew Mckenna
Top achievements
Rank 1
Matthew Mckenna asked on 20 Oct 2009, 02:54 AM
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

16 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 21 Oct 2009, 09:26 AM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 22 Oct 2009, 12:37 AM
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".
0
Matthew Mckenna
Top achievements
Rank 1
answered on 22 Oct 2009, 12:57 AM
Screenshots
0
Sebastian
Telerik team
answered on 22 Oct 2009, 08:56 AM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 23 Oct 2009, 05:02 AM
Edited. See below.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 23 Oct 2009, 07:21 AM

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?
0
Veli
Telerik team
answered on 23 Oct 2009, 01:16 PM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 26 Oct 2009, 01:16 AM
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
0
Veli
Telerik team
answered on 26 Oct 2009, 01:55 PM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 27 Oct 2009, 06:17 AM
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.
0
Veli
Telerik team
answered on 27 Oct 2009, 12:25 PM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 28 Oct 2009, 12:38 AM
Here's the configuration.
0
Veli
Telerik team
answered on 28 Oct 2009, 12:18 PM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 29 Oct 2009, 12:52 AM
You need to set the start time for daylight savings to 12am (rather than 12pm as shown in the video).
0
Veli
Telerik team
answered on 29 Oct 2009, 11:16 AM
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.
0
Matthew Mckenna
Top achievements
Rank 1
answered on 02 Nov 2009, 12:58 AM
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.
Tags
Calendar
Asked by
Matthew Mckenna
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Matthew Mckenna
Top achievements
Rank 1
Veli
Telerik team
Share this question
or