mirror of
https://github.com/langgenius/dify.git
synced 2026-06-20 17:21:06 +08:00
Co-authored-by: zhangx1n <zhangxin@dify.ai> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
21 lines
708 B
TypeScript
21 lines
708 B
TypeScript
/**
|
|
* Format workflow run identifier using finished_at timestamp
|
|
* @param finishedAt - Unix timestamp in seconds
|
|
* @param fallbackText - Text to show when finishedAt is not available (default: 'Running')
|
|
* @returns Formatted string like " (14:30:25)" or " (Running)"
|
|
*/
|
|
export function formatWorkflowRunIdentifier(finishedAt?: number, fallbackText = 'Running'): string {
|
|
if (!finishedAt) {
|
|
const capitalized = fallbackText.charAt(0).toUpperCase() + fallbackText.slice(1)
|
|
return ` (${capitalized})`
|
|
}
|
|
|
|
const date = new Date(finishedAt * 1000)
|
|
const timeStr = date.toLocaleTimeString([], {
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
second: '2-digit',
|
|
})
|
|
return ` (${timeStr})`
|
|
}
|