We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9d92a5 commit 7830dc7Copy full SHA for 7830dc7
src/logger/utils/time.mjs
@@ -10,10 +10,12 @@
10
export const prettifyTimestamp = timestamp => {
11
const date = new Date(timestamp);
12
13
- const hours = date.getUTCHours().toString().padStart(2, '0');
14
- const minutes = date.getUTCMinutes().toString().padStart(2, '0');
15
- const seconds = date.getUTCSeconds().toString().padStart(2, '0');
16
- const milliseconds = date.getUTCMilliseconds().toString().padStart(3, '0');
17
-
18
- return `${hours}:${minutes}:${seconds}.${milliseconds}`;
+ return new Intl.DateTimeFormat('en-US', {
+ timeZone: 'UTC',
+ hour12: false,
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
19
+ fractionalSecondDigits: 3,
20
+ }).format(date);
21
};
0 commit comments