INNER CODE UNIT · TypeScript

who

rowboatlabs/rowboat · apps/harbor/packages/server/src/connectors/cal/index.ts:103

  const who = (b.attendees ?? []).map((a) => a.name || a.email).filter(Boolean).join(', ');
  const where = b.location && /^https?:\/\//.test(b.location) ? ` · [join](${b.location})` : '';
  return `- **${formatWhen(b.start, timeZone)}**: ${b.title}${who ? ` with ${who}` : ''}${where} · \`${b.uid}\``;
}

/** The bookings starting on these dates (YYYY-MM-DD, in the owner's zone), soonest first. */
async function bookingsOn(api: CalApi, from: string, toExclusive: string, empty: string, heading: string): Promise<string> {
  const me = await api.profile();
  const afterStart = zonedToUtc(`${from}T00:00:00`, me.timeZone).toISOString();
  const beforeEnd = zonedToUtc(`${toExclusive}T00:00:00`, me.timeZone).toISOString();
  const bookings = (await api.bookings({ status: 'upcoming', afterStart, beforeEnd, limit: 50 }))
    .filter((b) => b.start < beforeEnd)
    .sort((a, b) => a.start.localeCompare(b.start));
  if (bookings.length === 0) return empty;
  return [heading, ...bookings.slice(0, 20).map((b) => bookingLine(b, me.timeZone))].join('\n');
}

const today = (tz: string) => dateInZone(new Date(), tz);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…