Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

format.ts

5 lines153 Bytes

1export const formatDuration = (ms?: number): string => {
2 if (!ms) return '-'
3 if (ms < 1000) return `${ms}ms`
4 return `${(ms / 1000).toFixed(2)}s`
5}