Posts

Showing posts from January, 2024

iCalendar - Create .ics file using C#

  using Ical.Net; using Ical.Net.CalendarComponents; using Ical.Net.DataTypes; using Ical.Net.Serialization; using NodaTime.TimeZones; using TimeZoneConverter; public class ICalNetHelper     {         #region REFERENCES         //Ical.Net 4.2.0         //https://blog.elmah.io/generate-calendar-in-ical-format-with-net-using-ical-net/         //https://github.com/rianjs/ical.net         //https://github.com/rianjs/ical.net/wiki/Deserialize-an-ics-file         //https://github.com/rianjs/ical.net/wiki         #endregion         public System.Net.Mail.Attachment CreateiCalendarMeetingInvite(string emailTo, string subject, string body, string dtMMddyyyyTHHmmssZ)         {             #region iCal Basic format             /*     ...

iCalendar - Create .ics file using Javascript

function WeeklyCalender(month,day,hour,startTime,endTime,reminderBeforeTime,frequency,summary,additionalAttributes) { var dayOfWeek = day; var startDate = new Date(); if(day!=-1) startDate.setDate(startDate.getDate() + (dayOfWeek + 7 - startDate.getDay()) % 7) startDate.setHours(hour,startTime,0,0); var endDate = new Date(); if(day!=-1) endDate.setDate(endDate.getDate() + (dayOfWeek + 7 - endDate.getDay()) % 7) endDate.setHours(hour,endTime,0,0); var untilDate = new Date(); if(day!=-1)  untilDate.setDate(untilDate.getDate() + (dayOfWeek + 7 - untilDate.getDay()) % 7) untilDate.setMonth(month);   var blob = new Blob(["BEGIN:VCALENDAR\nBEGIN:VEVENT\nCREATED:"+startDate.toISOString().replaceAll('-','').replaceAll(':','')+"\nDTEND;TZID="+Intl.DateTimeFormat().resolvedOptions().timeZone+":"+endDate.toISOString().replaceAll('-','').replaceAll(':','')+"\nDTSTAMP:"+startDate.toISOString().re...