Time Zone Planner
Find a meeting time across time zones. Turn the meeting round a 24-hour dial where each ring is someone's day.
Installation
npx shadcn@latest add @kokonutui/timezone-planner
Props
| Prop |
Type |
Default |
Description |
people? |
PlannerPerson[] |
built-in |
The first person is "you": the dial runs on their clock. |
date? |
Date |
|
The day to plan. Defaults to today. |
defaultStart? |
number |
16 * 60 |
Start of the meeting in minutes after midnight, on the first person's clock. |
defaultDuration? |
number |
60 |
Length of the meeting in minutes. |
onChange? |
(slot: PlannerSlot) => void |
|
Called when the slot settles: after a drag, a key press or Best time. |
className? |
string |
|
Extra classes for the root element. |
PlannerPerson
| Field |
Type |
Description |
id |
string |
|
name |
string |
|
city |
string |
|
timeZone |
string |
IANA zone, such as "America/New_York". |
workStart? |
number |
Start of their working day, in local hours. |
workEnd? |
number |
End of their working day, in local hours. |
PlannerSlot
| Field |
Type |
Description |
start |
Date |
|
end |
Date |
|
available |
string[] |
Ids of the people for whom the whole slot is in working hours. |
Source
"use client";
interface PlannerPerson {
id: string;
name: string;
city: string;
/** IANA zone, such as "America/New_York". */
timeZone: string;
/** Start of their working day, in local hours. */
workStart?: number;
/** End of their working day, in local hours. */
workEnd?: number;
}
interface PlannerSlot {
start: Date;
end: Date;
/** Ids of the people for whom the whole slot is in working hours. */
available: string[];
}
interface TimezonePlannerProps {
/** The first person is "you": the dial runs on their clock. */
people?: PlannerPerson[];
/** The day to plan. Defaults to today. */
date?: Date;
/** Start of the meeting in minutes after midnight, on the first person's clock. */
defaultStart?: number;
/** Length of the meeting in minutes. */
defaultDuration?: number;
/** Called when the slot settles: after a drag, a key press or Best time. */
onChange?: (slot: PlannerSlot) => void;
className?: string;
}
const DEFAULT_PEOPLE: PlannerPerson[] = [
{ id: "you", name: "You", city: "Paris", timeZone: "Europe/Paris" },
{ id: "lucas", name: "Lucas Moreau", city: "New York", timeZone: "America/New_York" },
{ id: "maya", name: "Maya Chen", city: "San Francisco", timeZone: "America/Los_Angeles" },
{ id: "priya", name: "Priya Nair", city: "Bengaluru", timeZone: "Asia/Kolkata" },
{ id: "aiko", name: "Aiko Tanaka", city: "Tokyo", timeZone: "Asia/Tokyo" },
];
function clock(minutes: number) {
const m = mod(Math.round(minutes), DAY);
return `${pad(Math.floor(m / 60))}:${pad(m % 60)}`;
}
default function TimezonePlanner({...}: TimezonePlannerProps) {
// component logic...
}