mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 05:28:43 +02:00
refactor(docs,blog): last update timestamp should be in milliseconds instead of seconds (#9963)
This commit is contained in:
parent
6c724ed857
commit
465cf4d82c
8 changed files with 35 additions and 29 deletions
|
@ -14,7 +14,7 @@ import {
|
|||
} from './gitUtils';
|
||||
import type {PluginOptions} from '@docusaurus/types';
|
||||
|
||||
export const GIT_FALLBACK_LAST_UPDATE_DATE = 1539502055;
|
||||
export const GIT_FALLBACK_LAST_UPDATE_DATE = 1539502055000;
|
||||
|
||||
export const GIT_FALLBACK_LAST_UPDATE_AUTHOR = 'Author';
|
||||
|
||||
|
@ -31,9 +31,9 @@ async function getGitLastUpdate(filePath: string): Promise<LastUpdateData> {
|
|||
}
|
||||
|
||||
export type LastUpdateData = {
|
||||
/** A timestamp in **seconds**, directly acquired from `git log`. */
|
||||
/** A timestamp in **milliseconds**, usually read from `git log` */
|
||||
lastUpdatedAt?: number;
|
||||
/** The author's name directly acquired from `git log`. */
|
||||
/** The author's name, usually coming from `git log` */
|
||||
lastUpdatedBy?: string;
|
||||
};
|
||||
|
||||
|
@ -105,7 +105,7 @@ export async function readLastUpdateData(
|
|||
|
||||
const frontMatterAuthor = lastUpdateFrontMatter?.author;
|
||||
const frontMatterTimestamp = lastUpdateFrontMatter?.date
|
||||
? new Date(lastUpdateFrontMatter.date).getTime() / 1000
|
||||
? new Date(lastUpdateFrontMatter.date).getTime()
|
||||
: undefined;
|
||||
|
||||
// We try to minimize git last update calls
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue