Skip to content

Commit 3e29d74

Browse files
committed
Mockdate on storybook
1 parent 68de326 commit 3e29d74

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

site/src/pages/CreateTokenPage/CreateTokenForm.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,12 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({
8080
<FormSection
8181
title="Expiration"
8282
description={
83-
<span data-chromatic="ignore">
84-
{form.values.lifetime
85-
? `The token will expire on ${dayjs()
86-
.add(form.values.lifetime, "days")
87-
.utc()
88-
.format("MMMM DD, YYYY")}`
89-
: "Please set a token expiration."}
90-
</span>
83+
form.values.lifetime
84+
? `The token will expire on ${dayjs()
85+
.add(form.values.lifetime, "days")
86+
.utc()
87+
.format("MMMM DD, YYYY")}`
88+
: "Please set a token expiration."
9189
}
9290
classes={{ sectionInfo: classNames.sectionInfo }}
9391
>

site/src/pages/CreateTokenPage/CreateTokenPage.stories.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const meta: Meta<typeof CreateTokenPage> = {
1212
},
1313
],
1414
},
15+
decorators: [
16+
(Story) => {
17+
Date.now = () => new Date("01/01/2014").getTime();
18+
return <Story />;
19+
},
20+
],
1521
};
1622

1723
export default meta;

0 commit comments

Comments
 (0)