vCalendar

Copy link to clipboard
Copied
Is there anything new in ColdFusion 8 to simplify the vCalendar link process?
Thanks!
Robin

Copy link to clipboard
Copied
What obvious mistake am I making? If I simply output the data, it is correct. When I save it to cfsavecontent, it isn't. Is it because I'm using the same filename in the output query and it is cacheing? If so, is there a way to clear the cfsavecontent variable each time it loops?
<cfoutput query="events">
<cfset count = count + 1>
<cfset tstartdate = "#dateformat(events.datetimeStarts,'mm/dd/yyyy')#">
<cfset tenddate = "#dateformat(events.datetimeEnds,'mm/dd/yyyy')#">
<cfset tstarttime = "#timeformat(events.datetimeStarts,'hhmmss')#">
<cfset tendtime = "#timeformat(events.datetimeEnds,'hhmmss')#">
<cfset tempEvent = events.event>
<cfset tempDescription = events.description>
<cfset vCalendar = StructNew()>
<cfset vCalendar.StartDate = "#dateformat(variables.tstartdate,'yyyymmdd')#">
<cfset vCalendar.EndDate = "#dateformat(variables.tenddate,'yyyymmdd')#">
<cfset vCalendar.StartTime = "#timeformat(events.datetimeStarts,'hhmmss')#">
<cfset vCalendar.EndTime = "#timeformat(events.datetimeEnds,'hhmmss')#">
<cfset vCalendar.Summary = "#variables.tempevent#">
<cfset vCalendar.Description = "#variables.tempdescription#">
<cfset vCalendar.Priority = 3>
<cfset vCalendar.FileName = "#event#.vcs">
<!--- create the calendar file contents --->
<cfsavecontent variable="vCalendar.content">
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:#vcalendar.startdate#T#vcalendar.starttime#Z
DTEND:#vcalendar.enddate#T#vcalendar.endtime#Z
TRANSP:1
SUMMARY:#vCalendar.Summary#
DESCRIPTION:#vCalendar.Description#
PRIORITY:#vCalendar.Priority#
END:VEVENT
END:VCALENDAR
</cfsavecontent>
<cffile action="WRITE" file="#ExpandPath(vCalendar.FileName)#" output="#Trim(vCalendar.content)#">
</cfoutput>

Copy link to clipboard
Copied
I think the problem is in the vCalendar struct... Have you tryied it with using just simple values (variable names)?
And why do you have 2 of these? vCalendar.StartDate and vCalendar.EndTime:
<cfset vCalendar.StartDate = "#dateformat(variables.tstartdate,'yyyymmdd')#">
<cfset vCalendar.EndDate = "#dateformat(variables.tenddate,'yyyymmdd')#">
<cfset vCalendar.StartTime = "#timeformat(events.datetimeStarts,'hhmmss')#">
<cfset vCalendar.EndTime = "#timeformat(events.datetimeEnds,'hhmmss')#">
Copy link to clipboard
Copied
Please specify what is the output you are getting and what is expected.
-Prasanth

Copy link to clipboard
Copied
I realized that it can be much simpler than my original:
<cfsavecontent variable="vCalendar.content">
BEGIN:VCALENDAR
VERSION:3.0
BEGIN:VEVENT
DAYLIGHT:TRUE;+01;20090329T010000;20091025T010000;EST;EDT
DTSTART;TZID=EST:#dateformat(datetimestarts,'yyyymmdd')#T#timeformat(dateadd("h",4,datetimestarts),'HHmmss')#Z
DTEND;TZID=EST:#dateformat(datetimeends,'yyyymmdd')#T#timeformat(dateadd("h",4,datetimeends),'HHmmss')#Z
TRANSP:1
SUMMARY:#events.event#
DESCRIPTION:#events.description#
PRIORITY:3
END:VEVENT
END:VCALENDAR
</cfsavecontent>
What is not working still?
1. time zone (EST)
2. daylight savings time (DST)
For some reason, these flags are not being picked up. I had to add the hours for the time zone, but this isn't the way it should work. Has anyone had success with time zone and daylight savings time in vcalendar?
One other thing that I had wrong that made a big difference was the 24-hour time (HH) rather than 12-hour time (hh). Everything fell into place once I changed this, with the exception of the EST and DST.

