mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 00:46:45 +01:00
13 lines
296 B
TypeScript
13 lines
296 B
TypeScript
|
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 />
|
||
|
}
|