/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {type ReactNode} from 'react'; import Translate from '@docusaurus/Translate'; import {ThemeClassNames} from '@docusaurus/theme-common'; import {useDateTimeFormat} from '@docusaurus/theme-common/internal'; import type {Props} from '@theme/LastUpdated'; function LastUpdatedAtDate({ lastUpdatedAt, }: { lastUpdatedAt: number; }): ReactNode { const atDate = new Date(lastUpdatedAt); const dateTimeFormat = useDateTimeFormat({ day: 'numeric', month: 'short', year: 'numeric', timeZone: 'UTC', }); const formattedLastUpdatedAt = dateTimeFormat.format(atDate); return ( ), }}> {' on {date}'} ); } function LastUpdatedByUser({ lastUpdatedBy, }: { lastUpdatedBy: string; }): ReactNode { return ( {lastUpdatedBy}, }}> {' by {user}'} ); } export default function LastUpdated({ lastUpdatedAt, lastUpdatedBy, }: Props): ReactNode { return ( ) : ( '' ), byUser: lastUpdatedBy ? ( ) : ( '' ), }}> {'Last updated{atDate}{byUser}'} {process.env.NODE_ENV === 'development' && (
{/* eslint-disable-next-line @docusaurus/no-untranslated-text */} (Simulated during dev for better perf)
)}
); }