Skip to content

Commit

Permalink
fix: round the timestamp to the nearest ms.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Jan 5, 2025
1 parent 4768adf commit 3c985db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/timestamp-hover/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(hoverProvider);
}

const regexpIsNumber = /^\d+$/;
const regexpIsNumber = /^\d+(?:\.\d*)?$/;

interface FormatTimestampOptions {
minDate: Date;
Expand All @@ -49,7 +49,7 @@ function formatTimestamp(text: string, options: FormatTimestampOptions): string
return undefined;
}
try {
return new Date(timestamp).toISOString();
return new Date(Math.round(timestamp)).toISOString();
} catch {
return undefined;
}
Expand Down

0 comments on commit 3c985db

Please sign in to comment.