Skip to content

Commit

Permalink
Merge pull request #1081 from InseeFr/1061-quand-on-choisit-une-date-…
Browse files Browse the repository at this point in the history
…dans-le-calendrier-les-jours-et-mois-sont-inverss

fix: solve date format for calendar
  • Loading branch information
PierreVasseur authored Nov 19, 2024
2 parents b541dab + 6958c8f commit 0579766
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/packages/components/date-picker/date-picker.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { render } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { DatePicker } from './';

describe('date-picker', () => {
it('renders without crashing', () => {
render(<DatePicker value="2024-01-01" onChange={vi.fn()} />);
const input: HTMLInputElement = screen.getByRole("combobox")
expect(input.value).toBe('01/01/2024')
});
});
1 change: 1 addition & 0 deletions src/packages/components/date-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const DatePicker = ({ value, onChange }: Readonly<DatePickerTypes>) => {
const date = value ? new Date(value) : undefined;
return (
<Calendar
dateFormat="dd/mm/yy"
value={date}
onChange={(e) => {
onChange(e.value?.toISOString());
Expand Down

0 comments on commit 0579766

Please sign in to comment.