Skip to main content

Mock Date

When you test your stories, it might be useful to mock new Date() so the displayed components always render same values. You can use meta.mockDate parameter to set a specific date and time:

import type { Story } from "@ladle/react";

export const DatePicker: Story = () => {
const date = new Date();
return (

DatePicker.meta = {
mockDate: "1995-12-17T03:24:00",