Gracefully handle when playback time might be a invalid date value (#126)

Co-authored-by: Warren <5959690+wrn14897@users.noreply.github.com>
This commit is contained in:
Mike Shi 2023-11-28 00:09:42 -08:00 committed by GitHub
parent 03f78dde12
commit 778492123c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
'@hyperdx/app': patch
---
Fix: Don't crash session replay player when playback timestamp is not a valid
date

View file

@ -28,7 +28,12 @@ function formatTs({
const seconds = Math.floor((value / 1000) % 60);
return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
} else {
return format(new Date(ts), 'hh:mm:ss a');
try {
return format(new Date(ts), 'hh:mm:ss a');
} catch (err) {
console.error(err, ts);
return '--:--';
}
}
}