This is Part 6 of the zero-dependency engineering series behind SOL-2027 (Part 1 · Part 2 · Part 3 · Part 4 · Part 5).

Building an interactive 13-month calendar explorer in the browser solves discovery, yet daily planning still lives inside Google Calendar, Apple Calendar, and Outlook. Readers who discovered their fixed-calendar birthday or looked up the 13 lunar cycles wanted one click to drop every 2027 International Fixed Calendar boundary — especially Month 07: SOL (Jun 18 – Jul 15), December 29 (Year Day), and all 13 UTC New Moons — straight onto their existing schedule.

Rather than pulling a 40 KB npm package like ics or ical-generator into a zero-build static site, we implemented a 35-line RFC 5545 generator in pure Vanilla JavaScript that runs identically in Node.js and the browser (Blob download, zero backend).

1. Why Hand-Rolled .ics Generators Break in Apple & Google Calendar

An iCalendar file looks deceptively simple until strict parsers silently reject it. In practice, three RFC 5545 rules cause almost every homegrown .ics export failure:

  1. Strict CRLF (\r\n) line endings (Section 3.1): Unix \n works in forgiving desktop importers, yet strict validators and mobile iOS share sheets expect \r\n between every content line and trailing newline.
  2. All-day DTEND is exclusive (Section 3.6.1): An all-day event on 2027-06-18 (SOL 1) must declare DTSTART;VALUE=DATE:20270618 and DTEND;VALUE=DATE:20270619 (midnight the following morning). Setting DTSTART and DTEND to the same date causes Google Calendar to ignore or collapse the event, while specifying a 28-day span stretches an unwanted banner across an entire month view. Marking each month's opening day as a clean 1-day milestone (with its 28-day span embedded in SUMMARY) keeps users' calendars readable.
  3. 75-octet line folding & text escaping (Sections 3.1 & 3.3.11): Literal backslashes, commas, and semicolons inside SUMMARY or DESCRIPTION must be escaped (\\, \,, \;), and any line exceeding 75 octets must fold with \r\n (CRLF followed by a single ASCII space).

2. The 35-Line Zero-Dependency RFC 5545 Generator

This exact 35-line JavaScript block mirrors web-app/app.js's canonical IFC_MONTHS and NEW_MOONS_2027 UTC ephemeris brackets (computed via Jean Meeus / PyEphem) and emits 27 compliant VEVENTs: 13 IFC month starts, Year Day on 2027-12-31, and all 13 New Moons of 2027.

const IFC_MONTHS = ['JANUARY','FEBRUARY','MARCH','APRIL','MAY','JUNE','SOL','JULY','AUGUST','SEPTEMBER','OCTOBER','NOVEMBER','DECEMBER']; const NEW_MOONS_2027 = [ [1,7,20,25],[2,6,15,57],[3,8,9,30],[4,6,23,52],[5,6,10,59],[6,4,19,41], [7,4,3,3],[8,2,10,6],[8,31,17,42],[9,30,2,37],[10,29,13,37],[11,28,3,25],[12,27,20,13] ]; const pad = (n) => String(n).padStart(2, '0'); const ymd = (d) => `${d.getUTCFullYear()}${pad(d.getUTCMonth() + 1)}${pad(d.getUTCDate())}`; const utcStamp = (d) => `${ymd(d)}T${pad(d.getUTCHours())}${pad(d.getUTCMinutes())}00Z`; const esc = (s) => s.replace(/[\\,;]/g, (c) => `\\${c}`).replace(/\n/g, '\\n'); const fold75 = (s) => (s.match(/.{1,73}/g) || [s]).join('\r\n '); function buildSOL2027ICS(now = new Date()) { const dtstamp = utcStamp(now), events = []; const push = (uid, start, end, sum, desc) => events.push([ 'BEGIN:VEVENT', `UID:${uid}@sol-2027.vercel.app`, `DTSTAMP:${dtstamp}`, start, end, `SUMMARY:${esc(sum)}`, `DESCRIPTION:${esc(desc)}`, 'END:VEVENT' ].map(fold75).join('\r\n')); IFC_MONTHS.forEach((name, i) => { const s = new Date(Date.UTC(2027, 0, 1 + i * 28)), e = new Date(Date.UTC(2027, 0, 2 + i * 28)); const end28 = new Date(Date.UTC(2027, 0, 28 + i * 28)); const span = `${ymd(s).slice(4,6)}/${ymd(s).slice(6)}-${ymd(end28).slice(4,6)}/${ymd(end28).slice(6)}`; push(`ifc-m${pad(i + 1)}-2027`, `DTSTART;VALUE=DATE:${ymd(s)}`, `DTEND;VALUE=DATE:${ymd(e)}`, `IFC ${pad(i + 1)}: ${name} 1 (${span})`, `Kodak 13x28 Month ${i + 1}/13 (${name}) - 28 days.`); }); push('ifc-yearday-2027', 'DTSTART;VALUE=DATE:20271231', 'DTEND;VALUE=DATE:20280101', 'DEC 29: YEAR DAY (Outside 7-Day Week)', 'Day 365/365 of SOL-2027 International Fixed Calendar.'); NEW_MOONS_2027.forEach(([m, d, h, min], i) => { const s = new Date(Date.UTC(2027, m - 1, d, h, min)), e = new Date(s.getTime() + 3600000); const ifcM = IFC_MONTHS[Math.floor((s - Date.UTC(2027, 0, 1)) / 86400000 / 28)]; push(`newmoon-${pad(i + 1)}-2027`, `DTSTART:${utcStamp(s)}`, `DTEND:${utcStamp(e)}`, `New Moon #${i + 1}/13 (${ifcM})`, `Exact 2027 UTC New Moon: ${pad(h)}:${pad(min)} UTC inside IFC ${ifcM}.`); }); return ['BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//SOL-2027//IFC 13-Month Calendar//EN', 'CALSCALE:GREGORIAN', 'METHOD:PUBLISH', 'X-WR-CALNAME:SOL-2027 (13 Months + 13 Moons)', 'X-WR-TIMEZONE:UTC', ...events, 'END:VCALENDAR', ''].join('\r\n'); } 

3. Subtle RFC 5545 & Date-Math Pitfalls Solved

Avoid line.replace(/(.{1,73})(?=.)/g, ...) When Folding

A classic regex trap when writing a one-line folder is pairing {1,73} with a positive lookahead (?=.): on a short 12-character line like BEGIN:VEVENT, the greedy quantifier backtracks to 11 characters so (?=.) can match the final T, splitting every short keyword into BEGIN:VEVEN\r\n T. Matching non-overlapping chunks with line.match(/.{1,73}/g) avoids backtracking altogether and guarantees every physical line stays strictly <= 74 ASCII bytes (under the 75-octet limit, accounting for the single leading space on continuation lines). If you inject non-ASCII emoji or accented characters into SUMMARY, switch from character regex chunking to TextEncoder UTF-8 byte-boundary slicing so multi-byte sequences never split mid-character.

Deterministic UIDs Prevent Duplicate Imports

Notice each event builds an immutable UID (ifc-m07-2027@sol-2027.vercel.app, newmoon-07-2027@sol-2027.vercel.app, ifc-yearday-2027@sol-2027.vercel.app) rather than calling crypto.randomUUID(). If a user downloads the .ics file twice and re-imports it into Apple Calendar or Outlook, stable UIDs merge and update cleanly instead of creating duplicate lunar markers across every month.

Timed UTC Events vs. All-Day VALUE=DATE Markers

IFC month transitions (SOL 1 on 20270618, YEAR DAY on 20271231) use VALUE=DATE because calendar days belong to the user's local midnight. Astronomical syzygies, however, are exact physical instants: New Moon #7 occurs at 2027-07-04 03:03 UTC, which is 23:03 EDT on July 3 in New York and 11:03 CST on July 4 in Singapore. Encoding DTSTART:20270704T030300Z with a trailing Z lets Google, Apple, and Outlook convert each of the 13 New Moons automatically into the user's local timezone while tagging which IFC month (Math.floor((s - Date.UTC(2027, 0, 1)) / 86400000 / 28)) holds it — proving that every single 2027 IFC month gets one New Moon with zero collisions.

4. Client-Side Browser Download & Node Verification

In the browser, wiring buildSOL2027ICS() to a 1-click button takes eight lines using Blob and URL.createObjectURL with text/calendar;charset=utf-8:

function downloadSOL2027ICS() { const blob = new Blob([buildSOL2027ICS()], { type: 'text/calendar;charset=utf-8' }); const url = URL.createObjectURL(blob); const a = Object.assign(document.createElement('a'), { href: url, download: 'SOL-2027-Google-Apple-Calendar.ics' }); document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(url), 1500); } 

Node.js Verification Output

Running buildSOL2027ICS(new Date('2026-11-25T00:00:00Z')) directly in Node produces 6,766 bytes across 225 physical lines (Max line bytes: 68 <= 75, CRLF only: true) and 27 unique VEVENT records matching web-app/app.js:

Event Key UID DTSTART (Verified) SUMMARY
Month 01 Start ifc-m01-2027@... VALUE=DATE:20270101 IFC 01: JANUARY 1 (01/01-01/28)
Month 07 SOL ifc-m07-2027@... VALUE=DATE:20270618 IFC 07: SOL 1 (06/18-07/15)
New Moon #7/13 newmoon-07-2027@... 20270704T030300Z New Moon #7/13 (SOL)
New Moon #9/13 newmoon-09-2027@... 20270831T174200Z New Moon #9/13 (AUGUST)
New Moon #13/13 newmoon-13-2027@... 20271227T201300Z New Moon #13/13 (DECEMBER)
Day 365 Intercalary ifc-yearday-2027@... VALUE=DATE:20271231 DEC 29: YEAR DAY (Outside 7-Day Week)

Explore SOL-2027 & Our New Dedicated Planning Hubs

Download the live 2027 calendar export, test your birthday on Kodak's 13-month grid, or explore workflow-specific guides built around the 28-day model:

What iCalendar parser quirks (TZID, RRULE, or Outlook X-WR-CALNAME ignoring) have bitten your apps when generating .ics feeds?