Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimePicker: fix date format when switching to 12-hour time format #37465

Merged
merged 9 commits into from
Jan 26, 2022
4 changes: 2 additions & 2 deletions packages/components/src/date-time/test/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe( 'TimePicker', () => {
).toBe( true );
} );

it( 'should have different layouts/orders for 12/24 hour formats', () => {
it( 'should have same layouts/orders for 12/24 hour formats', () => {
const onChangeSpy = jest.fn();

const { rerender } = render(
Expand Down Expand Up @@ -299,7 +299,7 @@ describe( 'TimePicker', () => {
screen.getByLabelText( 'Day' )
);

expect( monthInputIndex > dayInputIndex ).toBe( true );
expect( monthInputIndex < dayInputIndex ).toBe( true );
} );

it( 'Should set a time when passed a null currentTime', () => {
Expand Down
7 changes: 1 addition & 6 deletions packages/components/src/date-time/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,7 @@ export function TimePicker( { is12Hour, currentTime, onChange } ) {
</div>
);

const dayMonthFormat = is12Hour ? (
amustaque97 marked this conversation as resolved.
Show resolved Hide resolved
<>
{ dayFormat }
{ monthFormat }
</>
) : (
const dayMonthFormat = (
<>
{ monthFormat }
{ dayFormat }
Expand Down