Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsExport to vCal does not handle DST properlyExport to vCal does not handle DST properly
Previous
 
Next
New Post
4/24/2006 7:46 PM
 

Events module v3.2.0 on DNN 3.2.2.  When user clicks to "Export Event to Desktop Event" (personal calendar such as Outlook, Palm Desktop, it does not handle Daylight Saving Time.

All was fine converting an event to UTC prior to daylight savings time went into effect. But any event that falls inside the time period of daylight saving time is exported to local calendar 1 hour off. It does not matter what day it is now, it matters what the date of the event is.

I have a partial solution.  This does not solve it for world wide timezones or places in US where DST is not employed such as Hawaii, eastern IN and most of Arizona.  For these cases, the prior behavior exists. That is, no DST offset is considered.

In file EventController:

 Public Function ConvertDateTimeToTZ(ByVal FromDateTime As DateTime, ByVal FromTZ As Integer, ByVal ToTZ As Integer) As DateTime
            ' JJK. need to subtract minutes for Daylight Saving Time.
            ' So, check the FromTZ and determine what TimeZone that is, then check the start/end dates of DST.
            ' If date is between then subtract minutes.

            ' Since there is no way to instantiate a specific TimeZone, let's assume the timezone supports DST
            ' This is a problem in Arizona (-420), Hawaii (-600) and eastern Indiana (-300). So, always add the offset.
            Dim dstOffset As Double

            If ToTZ = 0 Then
                ' Must apply Daylight Saving Time offset.
                Dim tz As TimeZone = TimeZone.CurrentTimeZone ' Timezone of the server

                If tz.IsDaylightSavingTime(FromDateTime) Then ' TODO: need to determine if DST based on FromTZ, not server timezone.
                    Dim daylight As DaylightTime = tz.GetDaylightChanges(DateTime.Now.Year)
                    dstOffset = daylight.Delta.TotalMinutes() ' assumes DST offset is same for target as it is for this server (60 mins). Is this true for all areas/countries?
                Else
                    dstOffset = 0
                End If

            Else
                ' Converting from 1 timezone to another. Assume DST is applied in both
                ' and therefore, no DST offset is needed.
                ' This is a problem if converting FROM or TO a timezone that does not support DST when the other does.
                dstOffset = 0
            End If

            Return FromDateTime.AddMinutes(Convert.ToDouble(ToTZ) - Convert.ToDouble(FromTZ) - dstOffset)
        End Function

 
New Post
4/25/2006 9:56 AM
 
Currently DNN is handling this.  It is not a Event's module issue and should be resolved within the DNN TimeZone functions.  DNN itself does not handle Daylight Savings time.  One way to handle this would be to add to or adjust the DNN Timezone table.  Don't solve the symptom...solve the problem.
 
New Post
4/25/2006 12:08 PM
 

I guess I don't understand your comment. As you say, the DNN TimeZone functions do not handle DST. But, the ConvertDateTimeToTZ() function inside Events is not calling any DNN functions, so how is that relevant? If the Event module used the DNN functions, then I guess I could agree that its a DNN issue, but since Events is doing its own native TZ conversion in this one function, then I consider it an Events issue.

The Events module (and DNN) is working fine as far as knowing what timezone the portal is in and what timezone the user is in. And the single timezone offset provided by DNN is fine for standard time. So, all events show as the proper time in all places I can see except one: export to vCal. Which is where DST becomes relevant.

Adjusting the DNN TimeZone table won't help. That is, if you mean to edit the existing row for a timezone and change the single offset. Say, change Pacific time from -480 to -420. With only a single value, the conversion is either wrong for dates inside DST range or outside DST range. It really needs two offset values. The "standard" offset and the "DST" offset. Plus it needs starting and ending dates/times by year. The start/end of DST varies by year and time of day per timezone. That is, not all timezones change at the same time of day.

So, what DNN needs perhaps in its UserTime class is something like ConvertToUTC() and then Events module calls that inside ConvertDateTimeToTZ() when 3rd parm = 0. Or add ConvertDateTimeToTZ  to class UserTime and then Events can call that.

But until the day arrives that DNN provides the needed native function to handle DST and UTC dates (and that is a complicated problem not easily solved by a single table in XML), then I provided code that improves the vCal export weakness in the Events module. I realize it doesn't solve all cases, but it does fix some cases and all other cases are left to behave as before. Perhaps others can contribute to the effort and this issue can urge DNN core team to add some needed core functionality.

 
New Post
4/25/2006 2:48 PM
 

I guess what I'm saying is I had to rig this function because of the lack of support in DNN for Timezone adjustment.  The entire Event Module uses the DNN Timezone table to determine offsets (from UTC) which also present a Daylight Savings Time issue.

I did look at several, rather complicated solutions...but chose to rely on most of the DNN functionality (and replace sometime later when we get a global DNN solution)...the exception was the Export Function, since it is not implemented as a control and does not inherit DNN functionality.

 
New Post
5/22/2006 2:33 PM
 

Where is the Timezone Table located?  We used Enterprise Manager to look at the DNN tables and could find none that looked like it was related to Time or Time Zone.  Is it possible to change the offset in that table instead of going into the code?  If not, is it possible to remove the Export to vCal link from events on the calendar?  We just noticed this problem as well and are afraid that people using the feature will show up an hour late to all our events.

Or, are there plans to fix this in the next version?

Thanks

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsExport to vCal does not handle DST properlyExport to vCal does not handle DST properly


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out