Created
December 24, 2014 06:08
-
-
Save saw303/1e6327c5bcc0f6fef898 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def icalA() | |
{ | |
def start = new Date(114,11,22,19,10,0) | |
def end = new Date(114,11,22,20,0,0) | |
render( contentType: params.format == 'ics' ? 'text/calendar' : 'text/plain', filename: "ical-a.ics") { | |
calendar { | |
events { | |
event( | |
start: start, | |
end: end, | |
utc: true, | |
timezone: 'UTC', | |
summary: "Event with utc=true and UTC timezone - $ | |
{start}" | |
) | |
} | |
} | |
} | |
/* renders the following: | |
BEGIN:VCALENDAR | |
PRODID:-//Grails iCalendar plugin//NONSGML Grails iCalendar plugin//EN | |
VERSION:2.0 | |
CALSCALE:GREGORIAN | |
METHOD:PUBLISH | |
BEGIN:VEVENT | |
DTSTAMP:20141222T235440Z | |
DTSTART:20141222T191000Z | |
DTEND:20141222T200000Z | |
SUMMARY:Event with utc=true and UTC timezone - Mon Dec 22 19:10:00 CST 2014 | |
UID:20141222T235440Z-iCalPlugin-Grails | |
TZID:Europe/London | |
ORGANIZER: | |
END:VEVENT | |
END:VCALENDAR | |
*/ | |
} | |
def icalB() | |
{ | |
def start = new Date(114,11,22,19,10,0) | |
def end = new Date(114,11,22,20,0,0) | |
render( contentType: params.format == 'ics' ? 'text/calendar' : 'text/plain', filename: "ical-b.ics") { | |
calendar { | |
events { | |
event( | |
start: start, | |
end: end, | |
//utc: true, | |
//timezone: 'UTC', | |
summary: "Event with utc=false and no timezone - ${start} | |
" | |
) | |
} | |
} | |
} | |
/* renders the following: | |
BEGIN:VCALENDAR | |
PRODID:-//Grails iCalendar plugin//NONSGML Grails iCalendar plugin//EN | |
VERSION:2.0 | |
CALSCALE:GREGORIAN | |
METHOD:PUBLISH | |
BEGIN:VEVENT | |
DTSTAMP:20141222T235546Z | |
DTSTART:20141222T121000 | |
DTEND:20141222T130000 | |
SUMMARY:Event with utc=false and no timezone - Mon Dec 22 19:10:00 CST 2014 | |
UID:20141222T235546Z-iCalPlugin-Grails | |
TZID:Europe/Zurich | |
ORGANIZER: | |
END:VEVENT | |
END:VCALENDAR | |
*/ | |
} | |
def icalC() | |
{ | |
def start = new Date(114,11,22,19,10,0) | |
def end = new Date(114,11,22,20,0,0) | |
render( contentType: params.format == 'ics' ? 'text/calendar' : 'text/plain', filename: "ical-b.ics") { | |
calendar { | |
events { | |
event( | |
start: start, | |
end: end, | |
//utc: true, | |
timezone: 'UTC', | |
summary: "Event with utc=false and timezone UTC - $ | |
{start}" | |
) | |
} | |
} | |
} | |
/* renders the following: | |
BEGIN:VCALENDAR | |
PRODID:-//Grails iCalendar plugin//NONSGML Grails iCalendar plugin//EN | |
VERSION:2.0 | |
CALSCALE:GREGORIAN | |
METHOD:PUBLISH | |
BEGIN:VEVENT | |
DTSTAMP:20141222T235633Z | |
DTSTART:20141222T131000 | |
DTEND:20141222T140000 | |
SUMMARY:Event with utc=false and timezone UTC - Mon Dec 22 19:10:00 CST 2014 | |
UID:20141222T235633Z-iCalPlugin-Grails | |
TZID:Europe/London | |
ORGANIZER: | |
END:VEVENT | |
END:VCALENDAR | |
*/ | |
} | |
def icalD() | |
{ | |
def start = new Date(114,11,22,19,10,0) | |
def end = new Date(114,11,22,20,0,0) | |
render( contentType: params.format == 'ics' ? 'text/calendar' : 'text/plain', filename: "ical-d.ics") { | |
calendar { | |
events { | |
event( | |
start: start, | |
end: end, | |
utc: true, | |
//timezone: 'UTC', | |
summary: "Event with utc=true and no timezone - ${start} | |
" | |
) | |
} | |
} | |
} | |
/* renders the following: | |
BEGIN:VCALENDAR | |
PRODID:-//Grails iCalendar plugin//NONSGML Grails iCalendar plugin//EN | |
VERSION:2.0 | |
CALSCALE:GREGORIAN | |
METHOD:PUBLISH | |
BEGIN:VEVENT | |
DTSTAMP:20141222T235708Z | |
DTSTART:20141222T181000Z | |
DTEND:20141222T190000Z | |
SUMMARY:Event with utc=true and no timezone - Mon Dec 22 19:10:00 CST 2014 | |
UID:20141222T235708Z-iCalPlugin-Grails | |
TZID:Europe/Zurich | |
ORGANIZER: | |
END:VEVENT | |
END:VCALENDAR | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment