Skip to content

Commit 00ac2a2

Browse files
committed
fix: WorkspaceSchedule: show tz of schedule if available, default to dayjs guess
1 parent 91e3171 commit 00ac2a2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

site/src/components/WorkspaceSchedule/WorkspaceSchedule.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { FC } from "react"
1313
import { Link as RouterLink } from "react-router-dom"
1414
import { Workspace } from "../../api/typesGenerated"
1515
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
16-
import { stripTimezone } from "../../util/schedule"
16+
import { extractTimezone, stripTimezone } from "../../util/schedule"
1717
import { isWorkspaceOn } from "../../util/workspace"
1818
import { Stack } from "../Stack/Stack"
1919

@@ -66,7 +66,10 @@ export const Language = {
6666
}
6767
},
6868
editScheduleLink: "Edit schedule",
69-
schedule: `Schedule (${dayjs.tz.guess()})`,
69+
scheduleHeader: (workspace: Workspace): string => {
70+
const tz = workspace.autostart_schedule ? extractTimezone(workspace.autostart_schedule) : dayjs.tz.guess()
71+
return `Schedule (${tz})`
72+
},
7073
}
7174

7275
export interface WorkspaceScheduleProps {
@@ -81,7 +84,7 @@ export const WorkspaceSchedule: FC<WorkspaceScheduleProps> = ({ workspace }) =>
8184
<Stack spacing={2}>
8285
<Typography variant="body1" className={styles.title}>
8386
<ScheduleIcon className={styles.scheduleIcon} />
84-
{Language.schedule}
87+
{Language.scheduleHeader(workspace)}
8588
</Typography>
8689
<div>
8790
<span className={styles.scheduleLabel}>{Language.autoStartLabel}</span>

0 commit comments

Comments
 (0)