0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 00:46:45 +01:00
posthog/.storybook/decorators/withMockDate.tsx

13 lines
296 B
TypeScript
Raw Normal View History

import type { DecoratorFn } from '@storybook/react'
import MockDate from 'mockdate'
export const withMockDate: DecoratorFn = (Story, { parameters }) => {
if (parameters.mockDate) {
MockDate.set(parameters.mockDate)
} else {
MockDate.reset()
}
return <Story />
}