diff --git a/node-src/lib/uploadMetadataFiles.ts b/node-src/lib/uploadMetadataFiles.ts index 782eb371f..fe335b95a 100644 --- a/node-src/lib/uploadMetadataFiles.ts +++ b/node-src/lib/uploadMetadataFiles.ts @@ -4,7 +4,7 @@ import { withFile } from 'tmp-promise'; import { STORYBOOK_BUILD_LOG_FILE } from '../tasks/build'; import { Context, FileDesc } from '../types'; -import getMetadataHtml from '../ui/html/metadata.html'; +import metadataHtml from '../ui/html/metadata.html'; import uploadingMetadata from '../ui/messages/info/uploadingMetadata'; import { findStorybookConfigFile } from './getStorybookMetadata'; import { CHROMATIC_LOG_FILE } from './log'; @@ -48,7 +48,7 @@ export async function uploadMetadataFiles(ctx: Context) { } await withFile(async ({ path }) => { - const html = getMetadataHtml(ctx, files); + const html = metadataHtml(ctx, files); writeFileSync(path, html); files.push({ localPath: path, diff --git a/node-src/ui/html/metadata.html.stories.ts b/node-src/ui/html/metadata.html.stories.ts index b9b8a6b4f..e197743ee 100644 --- a/node-src/ui/html/metadata.html.stories.ts +++ b/node-src/ui/html/metadata.html.stories.ts @@ -45,6 +45,8 @@ const build: any = { build: { webUrl: 'https://www.chromatic.com/build?appId=5d67dc0374b2e300209c41e7&number=7805' }, }; -export const Default = () => metadataHtml(announced, files); +const date = new Date('2023-10-12T12:05:23.706Z'); -export const WithBuildLink = () => metadataHtml(build, files); +export const Default = () => metadataHtml(announced, files, date); + +export const WithBuildLink = () => metadataHtml(build, files, date); diff --git a/node-src/ui/html/metadata.html.ts b/node-src/ui/html/metadata.html.ts index e33e7eecd..020b0139f 100644 --- a/node-src/ui/html/metadata.html.ts +++ b/node-src/ui/html/metadata.html.ts @@ -4,7 +4,11 @@ import { Context, FileDesc } from '../../types'; const linkIcon = ''; -export default ({ announcedBuild, build }: Context, files: FileDesc[]) => ` +export default ( + { announcedBuild, build }: Context, + files: FileDesc[], + creationDate: Date = new Date() +) => ` @@ -62,7 +66,7 @@ export default ({ announcedBuild, build }: Context, files: FileDesc[]) => ` - Generated on ${new Date().toLocaleString('en', { + Generated on ${creationDate.toLocaleString('en', { timeStyle: 'medium', dateStyle: 'full', hourCycle: 'h24',