When someone sells a car privately in California, two short deadlines start the day after the sale: the seller has 5 days to file a Notice of Transfer and Release of Liability with the DMV, and the buyer has 10 days to report the change of ownership. People miss them because nobody writes them down. So the small calculator I built for our buyers and sellers does one extra thing besides showing the dates: it hands you a calendar file.

This post is about that part: building a valid .ics file entirely in the browser, with no server and no library.

General information, not legal advice. The California DMV is the authority on these deadlines.

The dates first

The rules are simple to encode once you decide to count calendar days and work with local dates at midnight:

var s = U.date('d-sale'); // local Date from <input type="date"> var nrl = U.add(s, 5); // seller: release of liability var tr = U.add(s, 10); // buyer: report the transfer // optional: smog certificate is valid for 90 days from the test date var exp = U.add(sm, 90); 

U.add is just setDate(getDate() + n) on a copy, which handles month ends and daylight-saving changes correctly. The helper that reads the input splits "2026-11-27" into parts and calls new Date(y, m - 1, d), because new Date("2026-11-27") would parse as UTC and land on the previous evening in California.

The smog date produces warnings rather than another deadline: if the certificate had already expired on the day of sale, the seller needs a new test; if it expires before the buyer's 10-day deadline, the buyer should file before it does.

The .ics file, by hand

iCalendar (RFC 5545) is a plain-text format, and for all-day reminders you need surprisingly little:

function d8(d) { return U.iso(d).replace(/-/g, ''); } // 2026-12-02 -> 20261202 var L = ['BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//Irvine Used Cars//DMV deadlines//EN']; ev.forEach(function (x, i) { L.push('BEGIN:VEVENT', 'UID:dmv-' + d8(x[1]) + '-' + i + '@irvineautosales.com', 'DTSTAMP:' + d8(new Date()) + 'T000000Z', 'DTSTART;VALUE=DATE:' + d8(x[1]), 'DTEND;VALUE=DATE:' + d8(U.add(x[1], 1)), 'SUMMARY:' + x[0], 'END:VEVENT'); }); L.push('END:VCALENDAR'); 

Details that matter in practice:

  • VALUE=DATE for all-day events. A date without a time is not tied to a time zone, so the reminder lands on the same day for everyone. With a DATE-TIME you would have to pick a zone and add a VTIMEZONE block.
  • DTEND is exclusive. A one-day event ends on the next day. Setting DTEND equal to DTSTART makes some calendar apps drop the event or show it as zero length.
  • CRLF line endings. The spec requires \r\n. Google Calendar tolerates \n, but some desktop clients do not, so the lines are joined with '\r\n'.
  • A stable, unique UID. Without it, importing the file twice creates duplicates. Building it from the date and the event index makes re-imports update the same events.
  • DTSTAMP is required in every VEVENT, even though nobody reads it.
  • Escape text values. In SUMMARY, commas, semicolons and backslashes must be escaped (\, \; \\). My current version doesn't do this, and one title, "File release of liability (NRL, REG 138)", has a comma. The calendar apps I tried accepted it anyway, but a one-line replace is on the to-do list.

Download without a server

var a = document.createElement('a'); a.href = URL.createObjectURL(new Blob([L.join('\r\n')], { type: 'text/calendar' })); a.download = 'dmv-deadlines.ics'; document.body.appendChild(a); a.click(); a.remove(); 

The Blob lives only in the browser, so nothing about the sale is sent anywhere. On iPhone, Safari usually offers to add the events to Calendar; on desktop the file opens in whatever calendar app is the default.

Next improvements: escape the text values, call URL.revokeObjectURL after the click to free the blob, and add a VALARM a day before each deadline.

Try it

The calculator with the official DMV sources is here: California DMV transfer deadline calculator. It is a single HTML file under the MIT license, so the .ics part is easy to lift into your own project.

Written with help from an AI assistant; I checked the dates against the DMV pages and the code against the live tool.