@@ -73,27 +73,26 @@ export const autoStartDisplay = (schedule: string | undefined): string => {
73
73
74
74
export const isShuttingDown = ( workspace : Workspace , deadline ?: Dayjs ) : boolean => {
75
75
if ( ! deadline ) {
76
+ if ( ! workspace . latest_build . deadline ) {
77
+ return false
78
+ }
76
79
deadline = dayjs ( workspace . latest_build . deadline ) . utc ( )
77
80
}
78
- const hasDeadline = deadline . year ( ) > 1
79
81
const now = dayjs ( ) . utc ( )
80
- return isWorkspaceOn ( workspace ) && hasDeadline && now . isAfter ( deadline )
82
+ return isWorkspaceOn ( workspace ) && now . isAfter ( deadline )
81
83
}
82
84
83
85
export const autoStopDisplay = ( workspace : Workspace ) : string => {
84
- const deadline = dayjs ( workspace . latest_build . deadline ) . utc ( )
85
- // a manual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
86
- // SEE: #1834
87
- const hasDeadline = deadline . year ( ) > 1
88
86
const ttl = workspace . ttl_ms
89
87
90
- if ( isWorkspaceOn ( workspace ) && hasDeadline ) {
88
+ if ( isWorkspaceOn ( workspace ) && workspace . latest_build . deadline ) {
91
89
// Workspace is on --> derive from latest_build.deadline. Note that the
92
90
// user may modify their workspace object (ttl) while the workspace is
93
91
// running and depending on system semantics, the deadline may still
94
92
// represent the previously defined ttl. Thus, we always derive from the
95
93
// deadline as the source of truth.
96
94
95
+ const deadline = dayjs ( workspace . latest_build . deadline ) . utc ( )
97
96
if ( isShuttingDown ( workspace , deadline ) ) {
98
97
return Language . workspaceShuttingDownLabel
99
98
} else {
0 commit comments