Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: honor account timezone in application interview displays (#3719)

Amruth Pillai5c1672917f77
diff --git a/apps/web/src/features/applications/components/application-card.tsx b/apps/web/src/features/applications/components/application-card.tsx
index a8a0060e5..6452a8761 100644
--- a/apps/web/src/features/applications/components/application-card.tsx
+++ b/apps/web/src/features/applications/components/application-card.tsx
@@ -1,9 +1,9 @@
import type { ApplicationSummary } from "../types";
-import { useLingui } from "@lingui/react";
import { Icon } from "@reactive-resume/ui/components/icon";
import { cn } from "@reactive-resume/utils/style";
import { describeNextStep, getNextStep } from "../next-step";
import { ApplicationActionsMenu } from "./application-actions-menu";
+import { useCareerTime } from "@/features/career/shared";
type ApplicationCardProps = {
application: ApplicationSummary;
@@ -15,8 +15,8 @@ type ApplicationCardProps = {
/** A board card: the company's initial, role and company, and the next step (warn when it's overdue). */
export function ApplicationCard({ application, onClick, withMenu = false, dragging = false }: ApplicationCardProps) {
- const { i18n } = useLingui();
- const next = describeNextStep(getNextStep(application), application, i18n.locale);
+ const { locale, timeZone } = useCareerTime();
+ const next = describeNextStep(getNextStep(application), application, locale, timeZone);
return (
<div
diff --git a/apps/web/src/features/applications/components/application-workflows.test.tsx b/apps/web/src/features/applications/components/application-workflows.test.tsx
index fba993096..758cc20b5 100644
--- a/apps/web/src/features/applications/components/application-workflows.test.tsx
+++ b/apps/web/src/features/applications/components/application-workflows.test.tsx
@@ -18,6 +18,7 @@ const api = vi.hoisted(() => ({
invalidate: vi.fn(),
confirm: vi.fn(),
}));
+vi.mock("@tanstack/react-router", () => ({ useRouteContext: () => ({ session: { user: { timezone: "UTC" } } }) }));
vi.mock("@/libs/orpc/client", () => ({
client: { applications: { ai: { parsePosting: api.parsePosting } } },
orpc: {
diff --git a/apps/web/src/features/applications/components/calendar-view.tsx b/apps/web/src/features/applications/components/calendar-view.tsx
index eb0d043ed..15e60fa4c 100644
--- a/apps/web/src/features/applications/components/calendar-view.tsx
+++ b/apps/web/src/features/applications/components/calendar-view.tsx
@@ -2,7 +2,6 @@ import type { ScheduledInterview } from "../interviews";
import type { ApplicationSummary } from "../types";
import type { InterviewTimelineEntry } from "@reactive-resume/schema/applications/data";
import { t } from "@lingui/core/macro";
-import { useLingui } from "@lingui/react";
import { Plural, Trans } from "@lingui/react/macro";
import { useState } from "react";
import { INTERVIEW_KINDS } from "@reactive-resume/schema/applications/data";
@@ -20,12 +19,18 @@ import {
upcomingInterviews,
} from "../interviews";
import { InterviewDialog } from "./interview-dialog";
+import { useCareerTime, useNow } from "@/features/career/shared";
const MAX_CHIPS_PER_DAY = 3;
type DialogState =
| { open: false }
- | { open: true; application: ApplicationSummary | null; interview: InterviewTimelineEntry | null; day: Date | null };
+ | {
+ open: true;
+ application: ApplicationSummary | null;
+ interview: InterviewTimelineEntry | null;
+ day: string | null;
+ };
type ApplicationCalendarProps = {
// Applications matching the page filters; their interviews are shown.
@@ -36,50 +41,50 @@ type ApplicationCalendarProps = {
};
export function ApplicationCalendar({ applications, allApplications, onOpen }: ApplicationCalendarProps) {
- const { i18n } = useLingui();
- const locale = i18n.locale;
- const [month, setMonth] = useState(() => {
- const now = new Date();
- return new Date(now.getFullYear(), now.getMonth(), 1);
- });
+ const { locale, timeZone, time } = useCareerTime();
+ const now = useNow();
+ const todayKey = dayKey(now, timeZone);
+ // Grid dates are civil days carried in UTC; interview start/end remain absolute instants.
+ const today = new Date(`${todayKey}T00:00:00Z`);
+ const [month, setMonth] = useState(() => new Date(`${todayKey.slice(0, 7)}-01T00:00:00Z`));
// Which way the last month change went: the new month's days slide in from that side. 0 = no change yet.
const [direction, setDirection] = useState<-1 | 0 | 1>(0);
const [dialog, setDialog] = useState<DialogState>({ open: false });
const interviews = collectInterviews(applications);
- const byDay = groupByDay(interviews);
+ const byDay = groupByDay(interviews, timeZone);
const upcoming = upcomingInterviews(interviews);
- const upcomingByDay = [...groupByDay(upcoming).values()];
+ const upcomingByDay = [...groupByDay(upcoming, timeZone).values()];
const days = monthGrid(month);
- // oxlint-disable-next-line react/purity -- Read today on each render so an open calendar updates after midnight when navigated.
- const today = new Date();
- const todayKey = dayKey(today);
- const tomorrowKey = dayKey(new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1));
- const isCurrentMonth = month.getFullYear() === today.getFullYear() && month.getMonth() === today.getMonth();
- const monthCount = interviews.filter(
- (item) => item.start.getFullYear() === month.getFullYear() && item.start.getMonth() === month.getMonth(),
- ).length;
+ const tomorrowKey = dayKey(new Date(today.getTime() + 86_400_000), "UTC");
+ const monthKey = dayKey(month, "UTC").slice(0, 7);
+ const isCurrentMonth = todayKey.startsWith(monthKey);
+ const monthCount = interviews.filter((item) => dayKey(item.start, timeZone).startsWith(monthKey)).length;
- const weekdayFormat = new Intl.DateTimeFormat(locale, { weekday: "short" });
- const monthFormat = new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" });
- const timeFormat = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" });
- const dayHeadingFormat = new Intl.DateTimeFormat(locale, { weekday: "long", month: "long", day: "numeric" });
+ const weekdayFormat = new Intl.DateTimeFormat(locale, { timeZone: "UTC", weekday: "short" });
+ const monthFormat = new Intl.DateTimeFormat(locale, { timeZone: "UTC", month: "long", year: "numeric" });
+ const dayHeadingFormat = new Intl.DateTimeFormat(locale, {
+ timeZone: "UTC",
+ weekday: "long",
+ month: "long",
+ day: "numeric",
+ });
const goToMonth = (next: Date) => {
setDirection(next > month ? 1 : -1);
setMonth(next);
};
- const shiftMonth = (delta: number) => goToMonth(new Date(month.getFullYear(), month.getMonth() + delta, 1));
- const schedule = (day: Date | null = null) => setDialog({ open: true, application: null, interview: null, day });
+ const shiftMonth = (delta: number) =>
+ goToMonth(new Date(Date.UTC(month.getUTCFullYear(), month.getUTCMonth() + delta, 1)));
+ const schedule = (day: string | null = null) => setDialog({ open: true, application: null, interview: null, day });
const edit = (item: ScheduledInterview) =>
setDialog({ open: true, application: item.application, interview: item.interview, day: null });
- const dayHeading = (date: Date) => {
- const key = dayKey(date);
+ const dayHeading = (key: string) => {
if (key === todayKey) return t`Today`;
if (key === tomorrowKey) return t`Tomorrow`;
- return dayHeadingFormat.format(date);
+ return dayHeadingFormat.format(new Date(`${key}T00:00:00Z`));
};
return (
@@ -101,7 +106,7 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
size="sm"
variant="secondary"
disabled={isCurrentMonth}
- onClick={() => goToMonth(new Date(today.getFullYear(), today.getMonth(), 1))}
+ onClick={() => goToMonth(new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), 1)))}
>
<Trans>This month</Trans>
</Button>
@@ -119,7 +124,7 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
<div className="grid grid-cols-7">
{days.slice(0, 7).map((day) => (
<div
- key={`weekday-${day.getDay()}`}
+ key={`weekday-${day.getUTCDay()}`}
className="border-b border-line p-2 text-center text-xs font-medium text-ink-3"
>
{weekdayFormat.format(day)}
@@ -127,7 +132,7 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
))}
</div>
<div
- key={`${month.getFullYear()}-${month.getMonth()}`}
+ key={monthKey}
className={cn(
"grid grid-cols-7",
direction !== 0 && "transition-[opacity,translate] duration-standard ease-enter starting:opacity-0",
@@ -136,9 +141,9 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
)}
>
{days.map((day, i) => {
- const key = dayKey(day);
+ const key = dayKey(day, "UTC");
const items = byDay.get(key) ?? [];
- const inMonth = day.getMonth() === month.getMonth();
+ const inMonth = day.getUTCMonth() === month.getUTCMonth();
const isToday = key === todayKey;
const extra = items.length - MAX_CHIPS_PER_DAY;
const date = dayHeadingFormat.format(day);
@@ -160,7 +165,7 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
title={scheduleLabel}
aria-label={scheduleLabel}
className="flex size-6 items-center justify-center rounded-md text-ink-3 opacity-0 transition-opacity group-hover/day:opacity-100 hover:bg-sunken hover:text-ink focus-visible:opacity-100 max-sm:hidden"
- onClick={() => schedule(day)}
+ onClick={() => schedule(key)}
>
<Icon name="plus" size={14} />
</button>
@@ -171,14 +176,14 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
isToday && "bg-accent font-semibold text-on-accent",
)}
>
- {day.getDate()}
+ {day.getUTCDate()}
</span>
</div>
{items.slice(0, MAX_CHIPS_PER_DAY).map((item) => (
<InterviewChip
key={item.interview.id}
item={item}
- time={timeFormat.format(item.start)}
+ time={time(item.start)}
onOpen={() => edit(item)}
/>
))}
@@ -195,12 +200,12 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
<Trans>+{extra} more</Trans>
</PopoverTrigger>
<PopoverContent align="start" className="flex w-60 flex-col gap-1 p-2">
- <p className="px-1 pb-1 text-xs font-medium">{dayHeading(day)}</p>
+ <p className="px-1 pb-1 text-xs font-medium">{dayHeading(key)}</p>
{items.map((item) => (
<InterviewChip
key={item.interview.id}
item={item}
- time={timeFormat.format(item.start)}
+ time={time(item.start)}
onOpen={() => edit(item)}
/>
))}
@@ -251,13 +256,13 @@ export function ApplicationCalendar({ applications, allApplications, onOpen }: A
const first = group[0];
if (!first) return null;
return (
- <div key={dayKey(first.start)} className="flex flex-col gap-2">
- <h4 className="text-xs font-medium text-ink-3">{dayHeading(first.start)}</h4>
+ <div key={dayKey(first.start, timeZone)} className="flex flex-col gap-2">
+ <h4 className="text-xs font-medium text-ink-3">{dayHeading(dayKey(first.start, timeZone))}</h4>
{group.map((item) => (
<UpcomingCard
key={item.interview.id}
item={item}
- timeRange={`${timeFormat.format(item.start)} – ${timeFormat.format(item.end)}`}
+ timeRange={`${time(item.start)} – ${time(item.end)}`}
locale={locale}
onEdit={() => edit(item)}
onOpenApplication={() => onOpen(item.application)}
diff --git a/apps/web/src/features/applications/components/detail/activity.tsx b/apps/web/src/features/applications/components/detail/activity.tsx
index bf45a001a..67e2a22b3 100644
--- a/apps/web/src/features/applications/components/detail/activity.tsx
+++ b/apps/web/src/features/applications/components/detail/activity.tsx
@@ -1,7 +1,6 @@
import type { Application } from "../../types";
import type { ApplicationTimelineEntry, InterviewTimelineEntry } from "@reactive-resume/schema/applications/data";
import { t } from "@lingui/core/macro";
-import { useLingui } from "@lingui/react";
import { Trans } from "@lingui/react/macro";
import { useMutation } from "@tanstack/react-query";
import { useState } from "react";
@@ -28,6 +27,7 @@ import { interviewKindOf } from "../../interviews";
import { getCategoryLane, getLaneLabel, isCurrentLaneEvent } from "../../lanes";
import { useInvalidateApplications } from "../../use-application-actions";
import { useApplicationLanes } from "../../use-application-lanes";
+import { useCareerTime } from "@/features/career/shared";
import { useClosingValue } from "@/hooks/use-closing-value";
import { useConfirm } from "@/hooks/use-confirm";
import { orpc } from "@/libs/orpc/client";
@@ -50,7 +50,7 @@ type ActivityProps = {
* date (and a note's text) or deletes it; the entry that anchors the current stage can't be deleted.
*/
export function Activity({ application, onOpenInterview }: ActivityProps) {
- const { i18n } = useLingui();
+ const { format } = useCareerTime();
const invalidate = useInvalidateApplications();
const confirm = useConfirm();
const { lanes } = useApplicationLanes();
@@ -82,7 +82,7 @@ export function Activity({ application, onOpenInterview }: ActivityProps) {
const sorted = [...application.activity].sort(byNewest);
const anchorId = sorted.find((entry) => isCurrentLaneEvent(entry, application))?.id;
const formatDate = (value: Date | string, withTime: boolean) =>
- new Date(value).toLocaleDateString(i18n.locale, {
+ format(value, {
month: "short",
day: "numeric",
// Stage and note entries are whole days, stored at noon UTC.
diff --git a/apps/web/src/features/applications/components/detail/next-step-card.test.tsx b/apps/web/src/features/applications/components/detail/next-step-card.test.tsx
index ce36590d0..ce9fa2dec 100644
--- a/apps/web/src/features/applications/components/detail/next-step-card.test.tsx
+++ b/apps/web/src/features/applications/components/detail/next-step-card.test.tsx
@@ -8,6 +8,7 @@ import { I18nProvider } from "@lingui/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const update = vi.hoisted(() => vi.fn().mockResolvedValue({}));
+vi.mock("@tanstack/react-router", () => ({ useRouteContext: () => ({ session: { user: { timezone: "UTC" } } }) }));
vi.mock("@/libs/orpc/client", () => ({
orpc: { applications: { update: { mutationOptions: () => ({ mutationFn: update }) } } },
}));
diff --git a/apps/web/src/features/applications/components/detail/next-step-card.tsx b/apps/web/src/features/applications/components/detail/next-step-card.tsx
index 125f2a772..da577531d 100644
--- a/apps/web/src/features/applications/components/detail/next-step-card.tsx
+++ b/apps/web/src/features/applications/components/detail/next-step-card.tsx
@@ -1,7 +1,6 @@
import type { Application } from "../../types";
import type { InterviewTimelineEntry } from "@reactive-resume/schema/applications/data";
import { t } from "@lingui/core/macro";
-import { useLingui } from "@lingui/react";
import { Trans } from "@lingui/react/macro";
import { useMutation } from "@tanstack/react-query";
import { useId, useState } from "react";
@@ -30,6 +29,7 @@ import { buildIcs } from "../../ics";
import { dayKey } from "../../interviews";
import { describeNextStep, getNextStep } from "../../next-step";
import { useInvalidateApplications } from "../../use-application-actions";
+import { useCareerTime } from "@/features/career/shared";
import { orpc } from "@/libs/orpc/client";
type NextStepCardProps = {
@@ -42,10 +42,10 @@ type NextStepCardProps = {
* to a calendar as an .ics file. Overdue steps are in warn.
*/
export function NextStepCard({ application, onScheduleInterview }: NextStepCardProps) {
- const { i18n } = useLingui();
+ const { locale, timeZone } = useCareerTime();
const [followUpOpen, setFollowUpOpen] = useState(false);
const step = getNextStep(application);
- const text = describeNextStep(step, application, i18n.locale);
+ const text = describeNextStep(step, application, locale, timeZone);
const addToCalendar = () => {
if (step.kind !== "interview" && step.kind !== "follow-up") return;
@@ -60,7 +60,8 @@ export function NextStepCard({ application, onScheduleInterview }: NextStepCardP
...(step.kind === "interview" && step.interview.notes ? { description: step.interview.notes } : {}),
});
const blob = new Blob([ics], { type: "text/calendar" });
- downloadWithAnchor(blob, `${application.company}-${dayKey(start)}.ics`.replace(/[^\w.-]+/g, "-"));
+ const date = dayKey(start, step.kind === "interview" ? timeZone : undefined);
+ downloadWithAnchor(blob, `${application.company}-${date}.ics`.replace(/[^\w.-]+/g, "-"));
};
return (
diff --git a/apps/web/src/features/applications/components/interview-dialog.tsx b/apps/web/src/features/applications/components/interview-dialog.tsx
index 4020ea649..f0dac22b3 100644
--- a/apps/web/src/features/applications/components/interview-dialog.tsx
+++ b/apps/web/src/features/applications/components/interview-dialog.tsx
@@ -86,9 +86,10 @@ type Draft = {
};
// New interviews default to the given day (or tomorrow) at 09:00 in the timezone, or the next full hour if that's past.
-function emptyDraft(applicationId: string, timezone: string, day?: Date | null): Draft {
+function emptyDraft(applicationId: string, timezone: string, day?: string | null): Draft {
const now = new Date();
- const date = dayKey(day ?? new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1));
+ const today = new Date(`${dayKey(now, timezone)}T00:00:00Z`);
+ const date = day ?? dayKey(new Date(today.getTime() + 86_400_000), "UTC");
let at = fromZonedDateTime(date, "09:00", timezone) ?? now;
if (at <= now) at = new Date(Math.ceil(now.getTime() / 3_600_000) * 3_600_000);
return {
@@ -135,7 +136,7 @@ type InterviewDialogProps = {
// Set when editing an existing interview.
interview?: InterviewTimelineEntry | null;
// Pre-selects this day when scheduling (e.g. a day clicked on the calendar).
- day?: Date | null;
+ day?: string | null;
};
const FULL_SCREEN_ON_PHONES =
diff --git a/apps/web/src/features/applications/components/list-view.test.tsx b/apps/web/src/features/applications/components/list-view.test.tsx
index 6deaa0bad..40d71a067 100644
--- a/apps/web/src/features/applications/components/list-view.test.tsx
+++ b/apps/web/src/features/applications/components/list-view.test.tsx
@@ -9,6 +9,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ApplicationList } from "./list-view";
const mocks = vi.hoisted(() => ({ breakpoint: "desktop", invalidate: vi.fn() }));
+vi.mock("@tanstack/react-router", () => ({ useRouteContext: () => ({ session: { user: { timezone: "UTC" } } }) }));
vi.mock("@/libs/orpc/client", () => ({
orpc: {
applications: {
diff --git a/apps/web/src/features/applications/components/list-view.tsx b/apps/web/src/features/applications/components/list-view.tsx
index d82b2001e..96f9bc510 100644
--- a/apps/web/src/features/applications/components/list-view.tsx
+++ b/apps/web/src/features/applications/components/list-view.tsx
@@ -27,6 +27,7 @@ import { LIST_ORDER } from "../stages";
import { useInvalidateApplications } from "../use-application-actions";
import { useApplicationLanes } from "../use-application-lanes";
import { ClosedLaneItems } from "./application-actions-menu";
+import { useCareerTime } from "@/features/career/shared";
import { useConfirm } from "@/hooks/use-confirm";
import { formatRelativeTime } from "@/libs/locale";
import { D2, EASE, EXIT } from "@/libs/motion";
@@ -261,7 +262,8 @@ const ApplicationRow = memo(function ApplicationRow({
onOpen,
}: ApplicationRowProps) {
const { i18n } = useLingui();
- const next = describeNextStep(getNextStep(application), application, i18n.locale);
+ const { timeZone } = useCareerTime();
+ const next = describeNextStep(getNextStep(application), application, i18n.locale, timeZone);
const sent = application.status !== "saved";
const tone = next.tone === "warn" ? "text-warn-text" : next.tone === "muted" ? "text-ink-3" : "text-ink-2";
diff --git a/apps/web/src/features/applications/components/timezone.test.tsx b/apps/web/src/features/applications/components/timezone.test.tsx
new file mode 100644
index 000000000..ee476b255
--- /dev/null
+++ b/apps/web/src/features/applications/components/timezone.test.tsx
@@ -0,0 +1,198 @@
+// @vitest-environment happy-dom
+import type { Application } from "../types";
+import type { ReactNode } from "react";
+import { act, cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
+import { i18n } from "@lingui/core";
+import { I18nProvider } from "@lingui/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { createDefaultApplicationLanes } from "@reactive-resume/schema/applications/lanes";
+
+const account = vi.hoisted(() => ({ timeZone: "UTC", saveInterview: vi.fn(), download: vi.fn() }));
+vi.mock("@reactive-resume/utils/file", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@reactive-resume/utils/file")>()),
+ downloadWithAnchor: account.download,
+}));
+vi.mock("@tanstack/react-router", () => ({
+ useRouteContext: () => ({ session: { user: { timezone: account.timeZone } } }),
+}));
+vi.mock("./interview-dialog", () => ({
+ InterviewDialog: ({ day }: { day: string | null }) => <output data-testid="scheduled-day">{day}</output>,
+}));
+vi.mock("../use-application-actions", () => ({ useInvalidateApplications: () => vi.fn() }));
+vi.mock("../use-application-lanes", () => ({
+ useApplicationLanes: () => ({ lanes: createDefaultApplicationLanes() }),
+}));
+vi.mock("@/hooks/use-confirm", () => ({ useConfirm: () => vi.fn() }));
+vi.mock("@/libs/orpc/client", () => ({
+ orpc: {
+ applications: {
+ listSummary: { queryKey: () => ["applications"] },
+ getById: { queryKey: () => ["application"] },
+ addInterview: { mutationOptions: () => ({ mutationFn: account.saveInterview }) },
+ updateInterview: { mutationOptions: () => ({ mutationFn: account.saveInterview }) },
+ addNote: { mutationOptions: () => ({ mutationFn: vi.fn() }) },
+ updateTimelineEntry: { mutationOptions: () => ({ mutationFn: vi.fn() }) },
+ deleteTimelineEntry: { mutationOptions: () => ({ mutationFn: vi.fn() }) },
+ update: { mutationOptions: () => ({ mutationFn: vi.fn() }) },
+ },
+ career: { schedules: { queryOptions: () => ({ queryKey: ["schedules"], queryFn: () => [] }) } },
+ },
+}));
+
+import { ApplicationCalendar } from "./calendar-view";
+import { Activity } from "./detail/activity";
+import { NextStepCard } from "./detail/next-step-card";
+
+function application(at: string): Application {
+ return {
+ id: "application",
+ company: "Northstar",
+ role: "Engineer",
+ status: "interview",
+ closedReason: null,
+ followUpAt: null,
+ followUpNote: null,
+ appliedAt: new Date("2026-10-01T12:00:00Z"),
+ activity: [
+ {
+ id: "interview",
+ type: "interview",
+ at: new Date(at),
+ kind: "technical",
+ durationMinutes: 60,
+ timezone: "UTC",
+ location: "",
+ notes: "",
+ participants: [],
+ audience: "other",
+ },
+ { id: "stage", type: "stage", at: new Date("2026-10-01T12:00:00Z"), stage: "interview" },
+ { id: "note", type: "note", at: new Date("2026-10-01T12:00:00Z"), text: "Sent portfolio" },
+ ],
+ } as Application;
+}
+
+function show(children: ReactNode) {
+ const client = new QueryClient();
+ return render(
+ <I18nProvider i18n={i18n}>
+ <QueryClientProvider client={client}>{children}</QueryClientProvider>
+ </I18nProvider>,
+ );
+}
+
+beforeEach(() => {
+ account.download.mockClear();
+ i18n.load("en-GB", {});
+ i18n.activate("en-GB");
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-10-30T08:00:00Z"));
+});
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+});
+
+it.each([
+ ["UTC", "2026-10-31"],
+ ["Europe/Berlin", "2026-11-01"],
+])("names the interview calendar download on the %s account date", (timeZone, date) => {
+ account.timeZone = timeZone;
+ show(<NextStepCard application={application("2026-10-31T23:30:00Z")} onScheduleInterview={vi.fn()} />);
+ fireEvent.click(screen.getByRole("button", { name: "Add to calendar" }));
+ expect(account.download).toHaveBeenCalledWith(expect.any(Blob), `Northstar-${date}.ics`);
+});
+
+it("keeps follow-up calendar filenames on the date selected by the browser-local editor", () => {
+ account.timeZone = "Pacific/Honolulu";
+ const followUp = { ...application("2026-10-31T23:30:00Z"), activity: [], followUpAt: new Date(2026, 9, 30, 9) };
+ show(<NextStepCard application={followUp} onScheduleInterview={vi.fn()} />);
+ fireEvent.click(screen.getByRole("button", { name: "Add to calendar" }));
+ expect(account.download).toHaveBeenCalledWith(expect.any(Blob), "Northstar-2026-10-30.ics");
+});
+
+it.each([
+ ["UTC", "09:00"],
+ ["Europe/Berlin", "10:00"],
+])("shows the %s clock in Next step, Activity and Calendar", (timeZone, time) => {
+ account.timeZone = timeZone;
+ const row = application("2026-10-30T09:00:00Z");
+ const { container } = show(
+ <>
+ <NextStepCard application={row} onScheduleInterview={vi.fn()} />
+ <Activity application={row} onOpenInterview={vi.fn()} />
+ <ApplicationCalendar applications={[row]} allApplications={[row]} onOpen={vi.fn()} />
+ </>,
+ );
+ expect(container.querySelector("#application-next-step")?.parentElement?.textContent).toContain(time);
+ expect(container.querySelector("#application-activity")?.parentElement?.textContent).toContain(time);
+ expect(container.querySelector('[data-day="2026-10-30"]')?.textContent).toContain(time);
+ expect(container.querySelector("[data-upcoming-interview]")?.textContent).toContain(time);
+});
+
+it("keeps stage and note dates as UTC whole days even east of the date boundary", () => {
+ account.timeZone = "Pacific/Kiritimati";
+ show(<Activity application={application("2026-10-30T09:00:00Z")} onOpenInterview={vi.fn()} />);
+ expect(screen.getAllByText("1 Oct")).toHaveLength(2);
+});
+
+it.each([
+ ["UTC", "October 2026", "2026-10-31"],
+ ["Europe/Berlin", "November 2026", "2026-11-01"],
+])("uses %s for the current month, count, day and upcoming heading", (timeZone, month, day) => {
+ account.timeZone = timeZone;
+ vi.setSystemTime(new Date("2026-10-31T23:15:00Z"));
+ const row = application("2026-10-31T23:30:00Z");
+ const { container } = show(<ApplicationCalendar applications={[row]} allApplications={[row]} onOpen={vi.fn()} />);
+ expect(screen.getByRole("heading", { name: month })).toBeDefined();
+ expect(screen.getByText("1 interview")).toBeDefined();
+ expect(screen.getByRole("heading", { name: "Today" })).toBeDefined();
+ const cell = container.querySelector(`[data-day="${day}"]`);
+ expect(cell?.textContent).toContain("Northstar");
+ if (!cell) throw new Error("Missing account calendar day");
+ fireEvent.click(within(cell as HTMLElement).getByRole("button", { name: /Schedule an interview on/ }));
+ expect(screen.getByTestId("scheduled-day").textContent).toBe(day);
+});
+
+it("labels tomorrow using the next civil day across the spring DST jump", () => {
+ account.timeZone = "Europe/Berlin";
+ vi.setSystemTime(new Date("2026-03-28T23:15:00Z"));
+ const row = application("2026-03-29T22:30:00Z");
+ const { container } = show(<ApplicationCalendar applications={[row]} allApplications={[row]} onOpen={vi.fn()} />);
+ expect(screen.getByRole("heading", { name: "Tomorrow" })).toBeDefined();
+ expect(container.querySelector('[data-day="2026-03-30"]')?.textContent).toContain("00:30");
+});
+
+it("keeps an edited interview's exact instant during the repeated DST hour", async () => {
+ account.timeZone = "UTC";
+ account.saveInterview.mockResolvedValue(undefined);
+ const { InterviewDialog } = await vi.importActual<typeof import("./interview-dialog")>("./interview-dialog");
+ const row = application("2026-10-25T01:30:00Z");
+ const interview = row.activity.find((entry) => entry.type === "interview");
+ if (!interview) throw new Error("Missing interview");
+ interview.timezone = "Europe/Berlin";
+ show(<InterviewDialog open application={row} interview={interview} onOpenChange={vi.fn()} />);
+ expect((screen.getByLabelText("Date") as HTMLInputElement).value).toBe("2026-10-25");
+ expect((screen.getByLabelText("Time · Europe/Berlin") as HTMLInputElement).value).toBe("02:30");
+ await act(async () => {
+ fireEvent.click(screen.getByRole("button", { name: "Save interview" }));
+ });
+ expect(account.saveInterview).toHaveBeenCalledWith(
+ expect.objectContaining({
+ at: "2026-10-25T01:30:00.000Z",
+ timezone: "Europe/Berlin",
+ entryId: "interview",
+ }),
+ expect.anything(),
+ );
+});
+
+it("uses the calendar-selected civil day in the real interview editor", async () => {
+ account.timeZone = "UTC";
+ const { InterviewDialog } = await vi.importActual<typeof import("./interview-dialog")>("./interview-dialog");
+ show(
+ <InterviewDialog open application={application("2026-10-30T09:00:00Z")} day="2026-10-31" onOpenChange={vi.fn()} />,
+ );
+ expect((screen.getByLabelText("Date") as HTMLInputElement).value).toBe("2026-10-31");
+});
diff --git a/apps/web/src/features/applications/interviews.test.ts b/apps/web/src/features/applications/interviews.test.ts
index 1bcb21796..3146489cf 100644
--- a/apps/web/src/features/applications/interviews.test.ts
+++ b/apps/web/src/features/applications/interviews.test.ts
@@ -1,5 +1,6 @@
+import type { ScheduledInterview } from "./interviews";
import { describe, expect, it } from "vite-plus/test";
-import { fromDateTimeLocal, toDateTimeLocal } from "./interviews";
+import { dayKey, fromDateTimeLocal, groupByDay, monthGrid, toDateTimeLocal } from "./interviews";
describe("interviews", () => {
it("round-trips datetime-local values", () => {
@@ -9,3 +10,31 @@ describe("interviews", () => {
expect(fromDateTimeLocal("")).toBeNull();
});
});
+
+// Instants stay absolute; only their calendar bucket changes with the account clock.
+describe("account calendar days", () => {
+ it.each([
+ ["2026-10-30T23:30:00Z", "2026-10-30", "2026-10-31"],
+ ["2026-10-31T23:30:00Z", "2026-10-31", "2026-11-01"],
+ ["2026-03-28T23:30:00Z", "2026-03-28", "2026-03-29"],
+ ["2026-03-29T22:30:00Z", "2026-03-29", "2026-03-30"],
+ ["2026-10-25T00:30:00Z", "2026-10-25", "2026-10-25"],
+ ["2026-10-25T01:30:00Z", "2026-10-25", "2026-10-25"],
+ ])("groups %s by account date across midnight and DST", (iso, utc, berlin) => {
+ const start = new Date(iso);
+ const event = { start } as ScheduledInterview;
+ expect(dayKey(start, "UTC")).toBe(utc);
+ expect(dayKey(start, "Europe/Berlin")).toBe(berlin);
+ expect([...groupByDay([event], "UTC").keys()]).toEqual([utc]);
+ expect([...groupByDay([event], "Europe/Berlin").keys()]).toEqual([berlin]);
+ expect(start.toISOString()).toBe(iso.replace("Z", ".000Z"));
+ });
+
+ it("keeps all six weeks as consecutive whole days across DST", () => {
+ const days = monthGrid(new Date("2026-03-01T00:00:00Z"));
+ expect(days).toHaveLength(42);
+ expect(days[0]?.toISOString()).toBe("2026-03-01T00:00:00.000Z");
+ expect(days.at(-1)?.toISOString()).toBe("2026-04-11T00:00:00.000Z");
+ expect(days.every((day, i) => i === 0 || day.getTime() - (days[i - 1]?.getTime() ?? 0) === 86_400_000)).toBe(true);
+ });
+});
diff --git a/apps/web/src/features/applications/interviews.ts b/apps/web/src/features/applications/interviews.ts
index 895de7c11..ca02236ed 100644
--- a/apps/web/src/features/applications/interviews.ts
+++ b/apps/web/src/features/applications/interviews.ts
@@ -49,8 +49,15 @@ export function formatDuration(minutes: number, locale?: string) {
const pad = (value: number) => String(value).padStart(2, "0");
-// Local calendar day key (YYYY-MM-DD); interviews are bucketed by the viewer's timezone.
-export const dayKey = (date: Date) => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
+// Calendar day key (YYYY-MM-DD). Pass the account timezone when bucketing interview instants.
+export function dayKey(date: Date, timeZone?: string) {
+ const parts = Object.fromEntries(
+ new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" })
+ .formatToParts(date)
+ .map(({ type, value }) => [type, value]),
+ );
+ return `${parts.year}-${parts.month}-${parts.day}`;
+}
// Value for <input type="datetime-local"> in the viewer's timezone.
export function toDateTimeLocal(value: Date | string) {
@@ -66,20 +73,20 @@ export function fromDateTimeLocal(value: string) {
return Number.isNaN(date.getTime()) ? null : date.toISOString();
}
-// Six full weeks (42 days) covering the month, starting on `weekStartsOn` (0 = Sunday).
+// Six full weeks of UTC calendar dates, for arithmetic/labels independent of any clock or DST change.
export function monthGrid(month: Date, weekStartsOn = 0): Date[] {
- const first = new Date(month.getFullYear(), month.getMonth(), 1);
- const offset = (first.getDay() - weekStartsOn + 7) % 7;
+ const first = new Date(Date.UTC(month.getUTCFullYear(), month.getUTCMonth(), 1));
+ const offset = (first.getUTCDay() - weekStartsOn + 7) % 7;
return Array.from(
{ length: 42 },
- (_, i) => new Date(first.getFullYear(), first.getMonth(), first.getDate() - offset + i),
+ (_, i) => new Date(Date.UTC(first.getUTCFullYear(), first.getUTCMonth(), 1 - offset + i)),
);
}
-export function groupByDay(interviews: ScheduledInterview[]) {
+export function groupByDay(interviews: ScheduledInterview[], timeZone: string) {
const map = new Map<string, ScheduledInterview[]>();
for (const item of interviews) {
- const key = dayKey(item.start);
+ const key = dayKey(item.start, timeZone);
map.set(key, [...(map.get(key) ?? []), item]);
}
return map;
diff --git a/apps/web/src/features/applications/next-step.test.ts b/apps/web/src/features/applications/next-step.test.ts
index 7d4c12000..798bdbc0c 100644
--- a/apps/web/src/features/applications/next-step.test.ts
+++ b/apps/web/src/features/applications/next-step.test.ts
@@ -1,6 +1,10 @@
import type { Application } from "./types";
import { describe, expect, it } from "vite-plus/test";
-import { daysInLane, getNextStep } from "./next-step";
+import { i18n } from "@lingui/core";
+
+i18n.load("en", {});
+i18n.activate("en");
+import { daysInLane, describeNextStep, getNextStep } from "./next-step";
const NOW = new Date("2026-09-28T12:00:00Z");
const day = (offset: number) => new Date(NOW.getTime() + offset * 86_400_000);
@@ -62,3 +66,23 @@ describe("getNextStep", () => {
expect(daysInLane(moved, NOW)).toBe(2);
});
});
+
+it.each([
+ ["UTC", "09:00"],
+ ["Europe/Berlin", "10:00"],
+])("describes interviews on the %s account clock", (timeZone, time) => {
+ const source = application({ activity: [interview(new Date("2026-10-30T09:00:00Z"))] });
+ const step = getNextStep(source, NOW);
+ const text = describeNextStep(step, { status: "interview", closedReason: null }, "en-GB", timeZone);
+ expect(text.sub).toContain(time);
+ expect(source.activity[0]?.at).toEqual(new Date("2026-10-30T09:00:00Z"));
+});
+
+it("keeps a follow-up on the calendar date selected in its browser-local editor", () => {
+ const at = new Date(2026, 9, 30, 9);
+ const step = getNextStep(application({ followUpAt: at }), NOW);
+ const expected = at.toLocaleString("en-GB", { weekday: "short", day: "numeric", month: "short" });
+ for (const timeZone of ["Pacific/Honolulu", "Pacific/Kiritimati"]) {
+ expect(describeNextStep(step, { status: "applied", closedReason: null }, "en-GB", timeZone).sub).toBe(expected);
+ }
+});
diff --git a/apps/web/src/features/applications/next-step.ts b/apps/web/src/features/applications/next-step.ts
index 1240dbd75..27f9b31e2 100644
--- a/apps/web/src/features/applications/next-step.ts
+++ b/apps/web/src/features/applications/next-step.ts
@@ -77,12 +77,13 @@ export function getNextStep(application: NextStepSource, now = new Date()): Next
export type NextStepText = { icon: IconName; title: string; sub: string; tone: "normal" | "warn" | "muted" };
-const formatWhen = (date: Date, locale: string, withTime: boolean) =>
+const formatWhen = (date: Date, locale: string, timeZone: string, withTime: boolean) =>
date.toLocaleString(locale, {
weekday: "short",
day: "numeric",
month: "short",
- ...(withTime ? { hour: "2-digit", minute: "2-digit" } : {}),
+ // Follow-ups retain the browser-local calendar date used by their date-only editor.
+ ...(withTime ? { timeZone, hour: "2-digit", minute: "2-digit" } : {}),
});
/** How a next step reads in the list, on cards and in the detail sheet. */
@@ -90,6 +91,7 @@ export function describeNextStep(
step: NextStep,
application: Pick<ApplicationSummary, "status" | "closedReason">,
locale: string,
+ timeZone: string,
): NextStepText {
switch (step.kind) {
case "interview": {
@@ -98,7 +100,7 @@ export function describeNextStep(
return {
icon: "calendar-dot",
title: t`${kind} interview`,
- sub: `${formatWhen(step.at, locale, true)}${where}`,
+ sub: `${formatWhen(step.at, locale, timeZone, true)}${where}`,
tone: "normal",
};
}
@@ -106,7 +108,7 @@ export function describeNextStep(
return {
icon: step.overdue ? "clock" : "calendar-dot",
title: step.note || t`Follow up`,
- sub: formatWhen(step.at, locale, false),
+ sub: formatWhen(step.at, locale, timeZone, false),
tone: step.overdue ? "warn" : "normal",
};
case "no-reply":
diff --git a/apps/web/src/features/career/workspace/messages.tsx b/apps/web/src/features/career/workspace/messages.tsx
index 28a7e74fb..a102caedc 100644
--- a/apps/web/src/features/career/workspace/messages.tsx
+++ b/apps/web/src/features/career/workspace/messages.tsx
@@ -192,7 +192,7 @@ type ProposalCardProps = {
*/
function ProposalCard({ reply, application, now, readOnly }: ProposalCardProps) {
const { i18n } = useLingui();
- const { when, day } = useCareerTime();
+ const { when, day, timeZone } = useCareerTime();
const queryClient = useQueryClient();
const invalidate = useInvalidateApplications();
const apply = useMutation(orpc.career.applyReply.mutationOptions());
@@ -214,7 +214,8 @@ function ProposalCard({ reply, application, now, readOnly }: ProposalCardProps)
const contact = application.contacts[0]?.name.split(" ")[0];
const current =
- application.followUpNote || describeNextStep(getNextStep(application, now), application, i18n.locale).title;
+ application.followUpNote ||
+ describeNextStep(getNextStep(application, now), application, i18n.locale, timeZone).title;
const describe = (change: (typeof changes)[number]) => {
switch (change.type) {
diff --git a/apps/web/src/features/career/workspace/shell.tsx b/apps/web/src/features/career/workspace/shell.tsx
index 469284159..8422fae91 100644
--- a/apps/web/src/features/career/workspace/shell.tsx
+++ b/apps/web/src/features/career/workspace/shell.tsx
@@ -460,7 +460,7 @@ type ContextColumnProps = {
/** NEXT STEP, WHO YOU'LL MEET, WHAT YOU SENT and NOTES: the job at a glance beside every tab. */
function ContextColumn({ application, interview, now, onEdit }: ContextColumnProps) {
const { i18n } = useLingui();
- const { day, date, time } = useCareerTime();
+ const { day, date, time, timeZone } = useCareerTime();
const documents = useQuery(orpc.documents.list.queryOptions({ input: { trashed: false } }));
const hasSentVersion = Boolean(application.sentResumeVersionId || application.sentCoverLetterVersionId);
const trashed = useQuery({
@@ -468,7 +468,7 @@ function ContextColumn({ application, interview, now, onEdit }: ContextColumnPro
enabled: hasSentVersion,
});
const step = getNextStep(application, now);
- const text = describeNextStep(step, application, i18n.locale);
+ const text = describeNextStep(step, application, i18n.locale, timeZone);
const upcoming = step.kind === "interview" ? step.interview : interview;
const soon = upcoming ? minutesUntil(new Date(upcoming.at), now) <= 60 : false;
const available = [...(documents.data ?? []), ...(trashed.data ?? [])];
diff --git a/docs/guides/career-workspace-reference.mdx b/docs/guides/career-workspace-reference.mdx
index 26397cc9f..fcde9aa43 100644
--- a/docs/guides/career-workspace-reference.mdx
+++ b/docs/guides/career-workspace-reference.mdx
@@ -85,6 +85,8 @@ Workspace buttons such as **Check fit** and **Read it for me** are separate AI a
| **Prepare** | Interview, AI connection; 24 hours before, 2 hours before or Morning of. | Saved briefing and a Today notification. |
| **Remind me** | Application, date and local time. | A one-time reminder in Today. |
+Interview times and calendar day grouping in Applications, its workspace and Today use your account timezone. Stage changes and notes keep their recorded whole-day dates.
+
Schedules use the account timezone from **Settings → Preferences**. Morning of means 08:00 on the interview day, or two hours before interviews starting before 10:00. Saving a preparation schedule whose run time has passed makes it due now.
Find roles and other web searches target the countries in **Where you're looking for work** under **Career → Knowledge → Preferences**: up to three, your account timezone's country until you change it, or none to search anywhere. Untouched UTC accounts adopt the device timezone's country on their first search or enabled discovery schedule. Each country is a separate search with the web service.
diff --git a/docs/guides/scheduling-interviews.mdx b/docs/guides/scheduling-interviews.mdx
index 78947963e..6df154cd6 100644
--- a/docs/guides/scheduling-interviews.mdx
+++ b/docs/guides/scheduling-interviews.mdx
@@ -70,7 +70,9 @@ You can also use **Next step → Edit** in an application workspace. Then fill i
/>
</Frame>
-The interview appears in the application's **Activity**, on the calendar, and as the **Next step** until it has finished. Scheduling an interview does not change the application's stage; move it to **Interview** when appropriate.
+The interview appears in the application's **Activity**, on the calendar, and as the **Next step** until it has finished. Interview times in **Next step**, **Activity** and **Calendar**, including day grouping and **Today**/**Tomorrow**, use your account timezone in **Settings → Preferences**, as **Career → Today** does. Stage changes and notes keep their recorded whole-day dates. Editing an interview keeps its saved timezone, and calendar export keeps the same instant.
+
+Scheduling an interview does not change the application's stage; move it to **Interview** when appropriate.
## Edit or delete an interview