Blog

Two-way calendar sync that keeps your unsent edits

Two-way sync with Google or Outlook has a classic bug: reading first can quietly undo a meeting you just moved. Here's the sync order Nemi Calendar uses, the safety rule behind it, the one case where your version wins on purpose, and a repeating event you can take apart.

Engineering8 min read

Fig. 01 row stores a series that never ends

Two-way calendar sync sounds simple: send your changes to Google, then fetch Google's changes back. The trouble is the order. Do those two steps backwards and a sync can quietly undo a meeting you just moved, without telling anyone, including you.

This post explains how Nemi Calendar protects edits you haven't sent yet, why a repeating event takes one row instead of a hundred, and the two cases where the rules deliberately let the other side win.

How can a calendar sync lose an edit?

Picture a meeting at 10:00 that you drag to 14:00 in Nemi. For a moment, the two calendars disagree: Nemi says 14:00 and Google still says 10:00. Now a sync runs.

If it reads from Google first, it finds the meeting at 10:00, sees that Nemi's copy is different, and brings it “up to date”. Your move is gone. When the sync then checks for local changes to send, there are none left.

Nothing about that looks like an error. Every step did what it was written to do. It's the kind of bug that shows up as a client turning up at the wrong time, which is why Nemi's sync is built so it can't happen. It's the same problem a document editor faces with an edit it hasn't saved yet, only with a second party that can change things too. Step through all three orders below.

One meeting, one sync, three orders

NemiDesign reviewTue 10:00GoogleDesign reviewTue 10:00

1/4Both calendars agree

Design review, Tuesday at 10:00, in Nemi and in Google.

Pull first is drawn only to show the failure. Nemi pushes first, and if a push fails, a second rule stops the pull from overwriting your change.

Why does Nemi push before it pulls?

Every change you make in Nemi is saved straight away and marked as unsent. When a Google or Outlook account syncs, it always does two things in order: it pushes every marked change to the provider, and only then reads what the provider has. By the time the read happens, your change is already on the other side, so the read brings back your own version.

That mark is cleared in exactly one place: when the provider accepts the change. Not when the request is sent, and not when the sync finishes, only on success. If the push fails because the provider refused it or the request never arrived, the change stays marked and retries on the next sync. You keep seeing your own version in the meantime, because it's the true one.

The not-yet-sent mark is cleared in exactly one place: when the provider says yes.

A second rule covers what the first one can't. When a pull brings in an event that is still marked locally, it refuses to overwrite it and skips that row. Even when a push fails and the read that follows brings back the old time, your change survives until it can be sent.

The one thing a pull still applies is a deletion or cancellation from the other side: if someone removed a meeting, it's removed here too. The two rules overlap on purpose. Either one alone would protect you most of the time, and together they protect you in the order things actually happen.

Is there anything this doesn't protect?

Yes, and that's a deliberate choice rather than an oversight.

Two edits to the same event at once: yours is sent last. Nemi doesn't ask the provider “has this changed since I last saw it?” before pushing. If you and someone in Google both move the same meeting before a sync runs, your push goes out first and replaces their version. The read that follows then brings back yours.

That's a real trade-off. The alternative is to stop and ask which version to keep. That's the right answer for documents, and the wrong one for a meeting time, where the last deliberate move is usually the one that counts.

What is protected

A change you made that hasn't reached Google or Outlook yet: a pull never writes an older version over it, no matter what order the reads and failures happen in.

What is not, by design

Someone else's edit to the same event, made in Google or Outlook in the same few minutes as yours. Your push goes out first, so your version stays. Your edit never undoes a delete, though: an event removed in Google stays removed, and the next sync takes it out of Nemi too.

How are repeating events stored?

A weekly stand-up that never ends has infinitely many occurrences, so storing each one isn't an option. Nemi stores the series the same way Google and Outlook do: one row holding the first occurrence and a repeat rule in the standard calendar format, such as FREQ=WEEKLY;BYDAY=TU. Occurrences are calculated from that rule whenever a week is drawn, and never written down.

Changing one occurrence adds a single override row that points at the series and names which occurrence it replaces. Moving next Tuesday's stand-up to 11:00 is an override with the new time. Cancelling it is an override marked cancelled, which leaves a hole in the series, just as Google and Outlook express “I deleted this one”. Try it below: pick an occurrence and move or cancel it.

One series, expanded by the calendar's own code

MonTueWedThuFriSatSun
5 Oct
6 Oct
7 Oct
8 Oct
9 Oct
10 Oct
11 Oct
12 Oct
13 Oct
14 Oct
15 Oct
16 Oct
17 Oct
18 Oct
19 Oct
20 Oct
21 Oct
22 Oct
23 Oct
24 Oct
25 Oct, clocks go back
26 Oct
27 Oct
28 Oct
29 Oct
30 Oct
31 Oct
1 Nov
2 Nov
3 Nov
4 Nov
5 Nov
6 Nov
7 Nov
8 Nov
9 Nov
10 Nov
11 Nov
12 Nov
13 Nov
14 Nov
15 Nov
16 Nov
17 Nov
18 Nov
19 Nov
20 Nov
21 Nov
22 Nov
23 Nov
24 Nov
25 Nov
26 Nov
27 Nov
28 Nov
29 Nov

Pick an occurrence to move or cancel just that one. Note the time stays at 09:00 on both sides of 25 October, while the stored time in UTC moves by an hour.

What is stored

  • 1 series: Every week on Tue, from 6 Oct at 09:00

What is drawn, in these eight weeks

8

occurrences from 1 stored row

Everything drawn here is the output of expandEvents and describeRRule, the functions Nemi Calendar runs, on a series that starts on 6 October 2026 at 09:00 in Amsterdam. Summer time ends on 25 October.

Why does the meeting stay at 09:00 when the clocks change?

Every time in Nemi is stored as an exact instant in UTC, so a row means the same moment to everyone who reads it. But a repeating meeting isn't a fixed number of hours apart. A weekly stand-up at 09:00 in Amsterdam is 07:00 UTC in October and 08:00 UTC in November, because the clocks go back in between. Expanding a rule by adding seven days of milliseconds would shift it to 08:00 local time for the whole winter.

Instead, Nemi expands the series on the wall clock of the event's own time zone. The rule produces “Tuesday, 09:00, Amsterdam”, and only then turns that into a UTC instant. That's why the explorer shows 09:00 on both sides of 25 October while the stored UTC time shifts by an hour. Outlook hands its times over in UTC, so for an Outlook series Nemi reads the organiser's time zone from the event and expands it on that wall clock too.

The expander handles the rules Google's own editor can produce, including “the last Friday of the month” and series that stop after a count or on a date. If a Google rule has extra parts Nemi doesn't use, it's stored exactly as it arrived and expanded on the parts Nemi understands, so nothing is silently dropped. Outlook describes repeats in its own format, which Nemi translates into a rule. Any pattern that can't be translated becomes a single event rather than a wrong series.

Who can see a connected calendar?

A connected calendar belongs to your account, not to a workspace. Connecting one never shows it to anyone else in your workspaces. ICS subscriptions are read-only and are never written to.

Nemi asks Google for your name and email address, a read-only list of your calendars, and access to calendar events. It only reads events in the calendars you enable, and the access token is encrypted before it's stored. What encrypted at rest means, and what it doesn't protect, has a post of its own. The privacy policy covers connected accounts in full.

For connecting an account step by step, see Connecting Google, Outlook and ICS feeds. For repeats and the “this event only” choices, see Events, invitations and repeats. The rest of the app is on the Calendar page.

Questions people ask

Does Nemi Calendar sync both ways with Google Calendar?

Yes. Changes you make in Nemi are sent to Google, and changes made in Google are read back into Nemi. Nemi always pushes its own changes before it pulls, so a sync never brings back the old version of a meeting you just moved.

Can I sync my Outlook calendar with Nemi?

Yes. Microsoft 365 and Outlook.com accounts connect the same way and sync both ways using the same push-before-pull rule. Outlook uses its own repeat format, which Nemi translates. Any pattern Nemi can't translate shows as a single event rather than a wrong series.

Why did my calendar sync undo my change?

Usually because the sync read from the provider before sending your local edit. It saw the old version on the server and copied it back over yours, with no error reported. Nemi pushes first and refuses to let a pull overwrite an unsent edit. The only exception is an event deleted or cancelled on the other side.

How often does Nemi Calendar sync?

When you move a meeting, Nemi sends that change within seconds. Opening Calendar syncs any account that hasn't synced in the last 4 minutes. A background job runs every 5 minutes to catch accounts that have gone 15 minutes without a sync, and the refresh button syncs right away.

What happens if two people edit the same event at the same time?

In Nemi, the last change sent wins. If you and someone in Google both move the same meeting before a sync runs, your push goes out first and replaces theirs. For a meeting time, the last deliberate move is usually the one that counts, so Nemi doesn't stop to ask.

Can people in my workspace see my connected calendar?

No. A calendar you connect to Nemi belongs to your account, not to a workspace, so no one else in your workspaces can see it. ICS subscriptions are read-only and Nemi never writes to them.

What access does Nemi ask Google for?

Your name and email address, a read-only list of your calendars, and access to calendar events so changes made in Nemi can reach Google. Nemi only reads events in the calendars you enable, and the access token Google gives us is encrypted before it's stored.

Where the numbers come from

  • Push before pull, and when a sync runslib/calendar/sync.ts (syncAccount, pushEventNow, syncAllDueAccounts, SYNC_STALE_MS)
  • A pull never writes over an unsent change, but does apply a deletionlib/calendar/providers/upsert.ts (upsertRemoteEvents)
  • The mark is cleared only on a successful pushlib/calendar/providers/google.ts, lib/calendar/providers/microsoft.ts
  • Series, overrides and expansion in the event's zonelib/calendar/occurrences.ts (expandEvents), lib/calendar/rrule.ts, lib/calendar/time.ts
  • The background schedulelib/server-init.ts
  • What a connected calendar shares/privacy
  • The Google scopes and the Outlook translationlib/calendar/providers/google.ts (SCOPES), lib/calendar/providers/microsoft.ts (toRRule)

Use the thing we write about.

Files, docs, sheets, mail, photos, calendar and meetings in one account, built the way this post describes. Nemi is opening in groups: put your name down and we tell you when yours is up.

15 GB free when you get in. No card needed.