Harden Teams session time formatting in UI.
Prevent Invalid Date rendering for bot responses when timestamps are missing or malformed. Made-with: Cursor
This commit is contained in:
parent
6ed0dee17d
commit
53dd0176b6
1 changed files with 3 additions and 1 deletions
|
|
@ -187,7 +187,9 @@ export const TeamsbotSessionView: React.FC = () => {
|
||||||
|
|
||||||
const _formatTime = (timestamp: string) => {
|
const _formatTime = (timestamp: string) => {
|
||||||
try {
|
try {
|
||||||
return new Date(timestamp).toLocaleTimeString('de-CH', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
const dt = new Date(timestamp);
|
||||||
|
if (!timestamp || Number.isNaN(dt.getTime())) return '';
|
||||||
|
return dt.toLocaleTimeString('de-CH', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
||||||
} catch {
|
} catch {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue