search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Today Navigation link not setting DayPilotCalendar to the correct date

Asked by Craig
14 years ago.

I've noticed that when I click the today button on the calendar header (onclick javascript event is dpc1.refreshCallBack(new Date()); that anytime after 4:00pm, it goes to the next day which is one day ahead of what it should. If I click on the button before 4:00pm, it goes to the correct day.

I'm in california and use the pacific timezone. Do I have to do some type of UTC date conversion?

Thanks

Craig

Comment posted by Dan Letecky
14 years ago.
Yes, you are correct. You should supply the time in UTC (i.e. the time on the client should always be +0000, the time zone will be added on the server).

I know that the UTC trick is a bit confusing (and moreover, the refresh(new Date()) example is not correct exactly as you point out). I would like to get rid of this and handle the time as local time on the client but IE is confusing the calculations by automatically changing to summer time zone in raw operations like Date.setTime() - in contrast to FF. Probably I will create a special wrapping Date class that will hide these problems.
Comment posted by Craig
14 years ago.

Does the control know which timezone the user is in or does it just assume the timezone that the server is set at? We have many users that are in different time zones and our application handles this outside of .net.

Comment posted by Dan Letecky
14 years ago.
DayPilot always shows the server times (or more precisely, it shows exactly the data from the database because the DateTime database field usually doesn't have the time zone information associated with it).

I'm not sure if there is a way to detect the time zone reliably in the browser (note the IE/FF differences I described above). It would be possible to add options to specify the server time zone (that can be detected automatically as well) and the client time zone (on the server side). You would have to keep the client time zone information in the user profiles and adjust DayPilot settings individually per user.
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.