refactor(docs,blog): last update timestamp should be in milliseconds instead of seconds (#9963)

This commit is contained in:
Sébastien Lorber 2024-03-19 09:51:27 +01:00 committed by GitHub
parent 6c724ed857
commit 465cf4d82c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 35 additions and 29 deletions

View file

@ -39,7 +39,7 @@ export async function getFileCommitDate(
): Promise<{
/** Relevant commit date. */
date: Date;
/** Timestamp in **seconds**, as returned from git. */
/** Timestamp returned from git, converted to **milliseconds**. */
timestamp: number;
}>;
/**
@ -66,7 +66,7 @@ export async function getFileCommitDate(
): Promise<{
/** Relevant commit date. */
date: Date;
/** Timestamp in **seconds**, as returned from git. */
/** Timestamp returned from git, converted to **milliseconds**. */
timestamp: number;
/** The author's name, as returned from git. */
author: string;
@ -150,8 +150,9 @@ export async function getFileCommitDate(
);
}
const timestamp = Number(match.groups!.timestamp);
const date = new Date(timestamp * 1000);
const timestampInSeconds = Number(match.groups!.timestamp);
const timestamp = timestampInSeconds * 1_000;
const date = new Date(timestamp);
if (includeAuthor) {
return {date, timestamp, author: match.groups!.author!};