Skip to content

Commit

Permalink
[docs] Fix incorrect DateInput date parser demo
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Dec 9, 2023
1 parent 16f2594 commit 21bf16e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import dayjs from 'dayjs';
import React from 'react';
import { MantineDemo } from '@mantinex/demo';
import { DateInput, DateInputProps } from '@mantine/dates';

const code = `
import dayjs from 'dayjs';
import { DateInput, DateInputProps } from '@mantine/dates';
const dateParser: DateInputProps['dateParser'] = (input) => {
if (input === 'WW2') {
return new Date(1939, 8, 1);
}
return new Date(input);
return return dayjs(input, 'DD/MM/YYYY').toDate();
};
function Demo() {
Expand All @@ -28,7 +31,8 @@ const dateParser: DateInputProps['dateParser'] = (input) => {
if (input === 'WW2') {
return new Date(1939, 8, 1);
}
return new Date(input);

return dayjs(input, 'DD/MM/YYYY').toDate();
};

function Demo() {
Expand Down

0 comments on commit 21bf16e

Please sign in to comment.