TimeRangePicker: do not swap time ranges when to is before from (#78915)

This commit is contained in:
Laura Fernández
2023-12-13 14:40:09 +01:00
committed by GitHub
parent 65535a3b3f
commit d28284c8f1
3 changed files with 10 additions and 23 deletions

View File

@@ -111,6 +111,9 @@ export function TimeRangePicker(props: TimeRangePickerProps) {
const variant = isSynced ? 'active' : isOnCanvas ? 'canvas' : 'default';
const isFromAfterTo = value?.to?.isBefore(value.from);
const timePickerIcon = isFromAfterTo ? 'exclamation-triangle' : 'clock-nine';
const currentTimeRange = formattedRange(value, timeZone);
return (
@@ -138,7 +141,7 @@ export function TimeRangePicker(props: TimeRangePickerProps) {
})}
aria-controls="TimePickerContent"
onClick={onToolbarButtonSwitch}
icon="clock-nine"
icon={timePickerIcon}
isOpen={isOpen}
variant={variant}
>