Skip to content

Commit

Permalink
default value for views on rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Balduini authored and Arthur Balduini committed Jun 12, 2024
1 parent 9cba106 commit cc12d23
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/x-date-pickers/src/TimePicker/shared.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { useThemeProps } from '@mui/material/styles';
import { useRtl } from '@mui/system/RtlProvider';
import { DefaultizedProps } from '../internals/models/helpers';
import { useUtils } from '../internals/hooks/useUtils';
import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
Expand Down Expand Up @@ -88,6 +89,8 @@ export function useTimePickerDefaultizedProps<
props,
name,
});
const isRtl = useRtl();
const defaultViews = isRtl ? ['minutes', 'hours'] : ['hours', 'minutes'];

const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();

Expand All @@ -109,7 +112,7 @@ export function useTimePickerDefaultizedProps<
...applyDefaultViewProps({
views: themeProps.views,
openTo: themeProps.openTo,
defaultViews: ['hours', 'minutes'] as TView[],
defaultViews: defaultViews as TView[],
defaultOpenTo: 'hours' as TView,
}),
disableFuture: themeProps.disableFuture ?? false,
Expand Down

0 comments on commit cc12d23

Please sign in to comment.