MCPcopy Index your code
hub / github.com/coder/coder / getMaxDeadline

Function getMaxDeadline

site/src/utils/schedule.tsx:198–206  ·  view source on GitHub ↗
(ws: Workspace | undefined)

Source from the content-addressed store, hash-verified

196 * @returns the latest datetime at which the workspace can be automatically shut down.
197 */
198export function getMaxDeadline(ws: Workspace | undefined): dayjs.Dayjs {
199 // note: we count runtime from updated_at as started_at counts from the start of
200 // the workspace build process, which can take a while.
201 if (ws === undefined) {
202 throw Error("Cannot calculate max deadline because workspace is undefined");
203 }
204 const startedAt = dayjs(ws.latest_build.updated_at);
205 return startedAt.add(deadlineExtensionMax);
206}
207
208/**
209 * Depends on the current time and a global constant.

Callers 2

schedule.test.tsFile · 0.90
AutostopDisplayFunction · 0.90

Calls 2

ErrorFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected