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

RadTimePicker TimeZone Problem

12 Answers 230 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sean Overman
Top achievements
Rank 1
Sean Overman asked on 30 May 2009, 06:31 AM
I have a webserver running on the west coast... PDT currently.  When a user in any other timezone selects a time from my TimePicker, it is adjusting the time to their local time.  IE.  TimePicker choice is 2pm, user selects 2pm, but in the box, it now shows 4pm.

I dont think i'm doing anything very complicated here:

Code In Front:
<tel:RadTimePicker ID="ChooseTime" runat="server" DateInput-ReadOnly="true" TimePopupButton-Visible="false"  width="60px">

Code Behind:

Page_Load Basiciliy:
List<DateTime> timeList = new List<DateTime>();
add a bunch of times from database (local PDT time) then
timeList.Sort();
ChooseTime.TimeView.DataList.DataSource = timeList;

How can I stop this behavior?

Thanks




12 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 01 Jun 2009, 12:43 PM
Hi Sean,

I tested the setup locally. However, the control behaved as expected. The time was consistent with the value chosen by the user, regardless of the time zone setting. Is there any additional logic in your project, which I may be leaving out?

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean Overman
Top achievements
Rank 1
answered on 01 Jun 2009, 04:47 PM
Hi, upon further review, I did fail to also tell you I was using the PopupAbove js code I found in this: RadTimePicker Demo
 
Code In Front as follows:
function PopupAbove() {
  var timePicker = $find("<%= ChooseTime.ClientID %>");
  var textBox = timePicker.get_textBox();
  var popupElement = timePicker.get_timePopupContainer();

  var dimensions = timePicker.getElementDimensions(popupElement);
  var position = timePicker.getElementPosition(textBox);

  timePicker.showTimePopup(position.x, position.y - dimensions.height);
  return true;
}

<tel:RadTimePicker ID="ChooseTime" runat="server" DateInput-ReadOnly="true" TimePopupButton-Visible="false"  width="60px" />
<span style="margin-top:6px;">
  <button  onclick="javascript: PopupAbove(); return false;" >Change Time</button>
</span>

I guess I should also mention that the code behind does "some" manipulation of the date from the DB.  All its doing though is basically this:

TimeSpan interval = new TimeSpan(0,15,0);
List<DateTime> timeList = new List<DateTime>();
while (startTime <= endTime) {
  if (!timeList.Contains(startTime)) {
    timeList.Add(startTime);
  }
  startTime = startTime.Add(interval);
}

StartTime and EndTime are DateTimes retrieved from DB on same machine.

Thanks
0
Sean Overman
Top achievements
Rank 1
answered on 01 Jun 2009, 06:04 PM
One additional repro step.   For testing this, if your using Firefox 3, you must restart your browser after changing your timezone, or else i'm guessing the javascript engine doesn't get reset.  However, in IE6, changing the timezone immeditialy takes affect on the page.  Haven't tested personally in IE7+, but the error was reported by a user using that. 

Thanks
0
Sean Overman
Top achievements
Rank 1
answered on 02 Jun 2009, 07:10 PM
Since no one has responded to this... I have made a test project to demonstrate the problem.

Download Here   i didn't include the Telerik.Web.UI dll to reduce the file size, so you need to place that in the bin.

To Repro:
Create virtual dir for this project on machine1.
On machine2, change timezone to something different than machine1, and navigate to website on machine1
Choose time, you notice that after the time is selected, it is corrected to match machine1 time for the time selected. 

I also tested this both ways, to make sure it wasn't something on my development box.  Meaning, I ran the website on Machine2, and tested from Machine1, and vice versa.

Any help would be greatly appreciated.

Thanks

PS. I know the Interval property is available, this example is a simpler version of what I'm doing to demonstrate the problem.




0
Yavor
Telerik team
answered on 04 Jun 2009, 08:10 AM
Hello Sean,

I was able to replicate the issue. I tracked it down to the code-behind logic:

.cs
protected void Page_Load(object sender,EventArgs args) {  
        if (!IsPostBack) {  
            List<DateTime> timeList = new List<DateTime>();  
 
            TimeSpan interval = new TimeSpan(0,15,0);  
 
            DateTime startTime = new DateTime(2009,2,23,9,0,0);  
            DateTime endTime = new DateTime(2009,2,23,17,0,0);  
 
            while (startTime <= endTime) {  
                timeList.Add(startTime);  
                startTimestartTime = startTime.Add(interval);  
            }  
 
            ChooseTime.TimeView.DataList.DataSource = timeList;  
        }  
    } 

I have escalated the issue to our developers, for further investigation.
In the meantime, you can set the start, endtime, and interval declaratively on the page, which local tests show eliminates the issue.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean Overman
Top achievements
Rank 1
answered on 04 Jun 2009, 06:53 PM
Thanks Yavor,
I'm glad that you were able to duplicate the issue.  Unfortunately, I need to build the timelist dynamically, because the available choices for the user to select depend or many other variables.  So setting those properties statically on the code in front is not a viable solution.

Is there any kind of javascript event I can hook into to "fix" the incorrect value after the choice has been made?

This is really a showstopper for us, and I'd appreciate any kind of additional help you can supply. 

Thanks
 
0
Yavor
Telerik team
answered on 05 Jun 2009, 12:56 PM
Hello Sean,

You can still declare the settings (start/end time) from the code behind:

.cs
 protected void Page_Load(object sender, EventArgs args)  
    {  
        if (!IsPostBack)  
        {  
            TimeSpan startTime = new TimeSpan(12, 0, 0);  
            TimeSpan endTime = new TimeSpan(18, 0, 0);  
 
            ChooseTime.TimeView.StartTime = startTime;  
            ChooseTime.TimeView.EndTime = endTime;  
        }  
    } 

This approach also does not exhibit the erroneous behavior mentioned previously.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean Overman
Top achievements
Rank 1
answered on 05 Jun 2009, 08:40 PM
Thanks Yavor,

As stated in my previous message, I need to set the timelist "dynamically", its the whole reason I am posting this problem, while I do appreciate you trying to give me solutions, you are not giving me a real solution.  I need to data bind to a list.  (this is a requirement)

Is there some javascript event that happens after the choice selection that I can connect to and possibly figure out what the correct value should be, and fix it?  Or can I possibly fix it server side?  Looking for any help here...

Thanks
0
Yavor
Telerik team
answered on 08 Jun 2009, 07:09 AM
Hello Sean,

Unfortunately, there is no other option, at present, to correct this behavior. I have escalated the issue to our developers, and they will soon look into it. In the meantime, you can use one of the two approaches which I suggested, while this problem is fixed in the next build.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael
Top achievements
Rank 1
answered on 28 Aug 2009, 02:13 PM
Yavor,

I have discovered the same problem, but under a different circumstance.  My application is hosted on a server in one timezone, and referenced by users in multiple timezones.  I store dates in a database server, which by default are assigned a time of 12:00 am (because the time is irrelevant).

The problem is that when we populate the date within the Date Picker it automatically adjust the time for the end user's timezone, which can also lead to the date being changed; for example, 12:00 am US Eastern Time will transalate to the prior date when referenced in a browser on Pacific time.

It sounds like the bug that you escalated back in June may address this problem.  Has this been fixed yet?

Otherwise, do you have any suggestions for a work around.  This is a critical problem to solve, so I would appreciate a quick response.
0
Yavor
Telerik team
answered on 31 Aug 2009, 07:36 AM
Hi Michael,

It seems that you have opened a support ticket for an identical issue. To avoid duplicate posts, we can continue our communication in the support ticket.

Regards,
Yavor
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
Iana Tsolova
Telerik team
answered on 02 Nov 2011, 09:58 AM
Hello,

After the further research from our developers it appeared that this issue cannot be fixed due to design limitations. However you workaround it, you can use some of the solutions provided in the below thread:
http://www.telerik.com/community/forums/aspnet-ajax/calendar/time-picker-bug-after-databinding-time-shows-up-in-client-time-zone.aspx

Kind regards,
Iana Tsolova
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
Tags
Calendar
Asked by
Sean Overman
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Sean Overman
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or