Skip to content

MockDate constructor doesn't support "MM/DD/YYYY, hh:ii:ss (AM|PM)" format #72

@inxmail-de-cln

Description

@inxmail-de-cln

When creating an instance of an MockDate with i.e. "10/24/2023, 1:59:00 AM" it throws an error: AssertionError: Unhandled date format passed to MockDate constructor: 10/24/2023, 1:59:00 AM.

It occurs while running tests using the current version of the Mantine-Framework and the error is been thrown at this line: https://github.com/mantinedev/mantine/blob/master/packages/@mantine/dates/src/components/DateTimePicker/DateTimePicker.tsx#L157

I guess the origin of this string is toLocaleString.

When using this pattern in the actual Date-constructor in Chrome, Firefox or Node.js it doesn't throw an error.

console.log(new Date("10/24/2023, 1:59:00 AM"));
//2023-10-23T23:59:00.000Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions