@@ -13,7 +13,7 @@ import { FC } from "react"
1313import { Link as RouterLink } from "react-router-dom"
1414import { Workspace } from "../../api/typesGenerated"
1515import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
16- import { extractTimezone , stripTimezone } from "../../util/schedule"
16+ import { stripTimezone } from "../../util/schedule"
1717import { isWorkspaceOn } from "../../util/workspace"
1818import { Stack } from "../Stack/Stack"
1919
@@ -31,20 +31,11 @@ export const Language = {
3131 return "Manual"
3232 }
3333 } ,
34- autoStartLabel : ( schedule : string | undefined ) : string => {
35- const prefix = "Start"
36- const timezone = schedule ? extractTimezone ( schedule ) : dayjs . tz . guess ( )
37-
38- if ( schedule ) {
39- return `${ prefix } (${ dayjs ( ) . tz ( timezone ) . format ( "z" ) } )`
40- } else {
41- return prefix
42- }
43- } ,
34+ autoStartLabel : "START" ,
35+ autoStopLabel : "SHUTDOWN" ,
4436 autoStopDisplay : ( workspace : Workspace ) : string => {
45- const schedule = workspace . autostart_schedule
4637 const deadline = dayjs ( workspace . latest_build . deadline ) . utc ( )
47- // a mannual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
38+ // a manual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
4839 // SEE: #1834
4940 const hasDeadline = deadline . year ( ) > 1
5041 const ttl = workspace . ttl_ms
@@ -59,8 +50,7 @@ export const Language = {
5950 if ( now . isAfter ( deadline ) ) {
6051 return "Workspace is shutting down"
6152 } else {
62- const timezone = schedule ? extractTimezone ( schedule ) : dayjs . tz . guess ( )
63- return deadline . tz ( timezone ) . format ( "HH:mm A" )
53+ return deadline . tz ( dayjs . tz . guess ( ) ) . format ( "hh:mm A" )
6454 }
6555 } else if ( ! ttl || ttl < 1 ) {
6656 // If the workspace is not on, and the ttl is 0 or undefined, then the
@@ -74,7 +64,7 @@ export const Language = {
7464 }
7565 } ,
7666 editScheduleLink : "Edit schedule" ,
77- schedule : " Schedule" ,
67+ schedule : ` Schedule ( ${ dayjs . tz . guess ( ) } )` ,
7868}
7969
8070export interface WorkspaceScheduleProps {
@@ -92,11 +82,13 @@ export const WorkspaceSchedule: FC<WorkspaceScheduleProps> = ({ workspace }) =>
9282 { Language . schedule }
9383 </ Typography >
9484 < div >
95- < span className = { styles . scheduleLabel } > { Language . autoStartLabel ( workspace . autostart_schedule ) } </ span >
96- < span className = { styles . scheduleValue } > { Language . autoStartDisplay ( workspace . autostart_schedule ) } </ span >
85+ < span className = { styles . scheduleLabel } > { Language . autoStartLabel } </ span >
86+ < span className = { styles . scheduleValue } data-chromatic = "ignore" >
87+ { Language . autoStartDisplay ( workspace . autostart_schedule ) }
88+ </ span >
9789 </ div >
9890 < div >
99- < span className = { styles . scheduleLabel } > Shutdown </ span >
91+ < span className = { styles . scheduleLabel } > { Language . autoStopLabel } </ span >
10092 < span className = { styles . scheduleValue } data-chromatic = "ignore" >
10193 { Language . autoStopDisplay ( workspace ) }
10294 </ span >
0 commit comments