Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ical.Net How do I properly add a Standard block to a VTimeZone #266

Closed
ehaltom opened this issue Apr 11, 2017 · 1 comment
Closed

Ical.Net How do I properly add a Standard block to a VTimeZone #266

ehaltom opened this issue Apr 11, 2017 · 1 comment

Comments

@ehaltom
Copy link

ehaltom commented Apr 11, 2017

Hi, I am migrating an app using DDay.Ical to Ical.Net. I never used either of these libraries so I apologize if this is common knowledge, but I can't find anywhere on how to duplicate the below portion of .ics output, specifically the STANDARD sub-component:

    BEGIN:VTIMEZONE
    TZID:US Mountain Standard Time
    BEGIN:STANDARD
    DTSTART:20170410T184315Z
    TZOFFSETFROM:-0700
    TZOFFSETTO:-0700
    END:STANDARD
    END:VTIMEZONE

Currently, I have this code, which creates a few extra properties, which I believe shouldn't hurt anything.

        ```

var start = DateTime.Now;
var end = start.AddHours(1);

        var tz = new VTimeZone("America/New_York");
        var standard = new Todo()
        {
            Name = Components.Standard,
            DtStart = new CalDateTime(start)
            
        };
        standard.AddProperty("UTCOFFSETTO", "-0700");
        standard.AddProperty("TZOFFSETFROM", "-0700");
        
        tz.Children.Add(standard);

        var cal = new Calendar();
        cal.AddTimeZone(tz);

        


        var serializer = new CalendarSerializer(new SerializationContext());

        var serializedCalendar = serializer.SerializeToString(cal);

        return serializedCalendar;

However, I am unsure if this is the best way to go about this. Is this the proper way to achieve the results I seek? 
@rianjs
Copy link
Collaborator

rianjs commented Nov 13, 2017

This is now possible in nuget version 4.0.0: https://www.nuget.org/packages/Ical.Net/4.0.0

@rianjs rianjs closed this as completed Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants