Skip to content

@sqlrooms/ai-core / useElapsedTime

Function: useElapsedTime() ​

useElapsedTime(isRunning, startedAt?, completedAt?): string | undefined

Returns a formatted elapsed-time string that auto-updates every second while the operation is running. Returns a static formatted duration when completed, or undefined when there is no timing data.

Parameters ​

ParameterType
isRunningboolean
startedAt?number
completedAt?number

Returns ​

string | undefined