Skip to content

Commit

Permalink
front: stdcm - new query should clear the hour field
Browse files Browse the repository at this point in the history
Related to #9533

TimePicker component should not have a `value` properety, it only needs
`hours`, `minutes` & `seconds`.

See OpenRailAssociation/osrd-ui#807 for more
informations

Signed-off-by: Benoit Simard <[email protected]>
  • Loading branch information
sim51 authored and SharglutDev committed Jan 9, 2025
1 parent 46bea7d commit fdfd8ac
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useOsrdConfActions, useOsrdConfSelectors } from 'common/osrdContext';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmPathStep } from 'reducers/osrdconf/types';
import { useAppDispatch } from 'store';
import { dateToHHMMSS, formatDateString } from 'utils/date';
import { formatDateString } from 'utils/date';
import { createStringSelectOptions } from 'utils/uiCoreHelpers';

import type { ArrivalTimeTypes, ScheduleConstraint } from '../../types';
Expand All @@ -28,16 +28,14 @@ const StdcmOpSchedule = ({ disabled, pathStep, opId, isOrigin = false }: StdcmOp
const { getSearchDatetimeWindow } = useOsrdConfSelectors();
const searchDatetimeWindow = useSelector(getSearchDatetimeWindow);

const { arrivalTime, arrivalTimeHours, arrivalTimeMinutes } = useMemo(() => {
const { arrivalTimeHours, arrivalTimeMinutes } = useMemo(() => {
if (!pathStep.arrival) {
return {
arrivalTime: undefined,
arrivalTimeHours: undefined,
arrivalTimeMinutes: undefined,
};
}
return {
arrivalTime: dateToHHMMSS(pathStep.arrival, { withoutSeconds: true }),
arrivalTimeHours: pathStep.arrival.getHours(),
arrivalTimeMinutes: pathStep.arrival.getMinutes(),
};
Expand Down Expand Up @@ -143,7 +141,6 @@ const StdcmOpSchedule = ({ disabled, pathStep, opId, isOrigin = false }: StdcmOp
});
}}
disabled={disabled}
value={arrivalTime}
readOnly={false}
/>
<div className="mr-n2 pr-1">
Expand Down

0 comments on commit fdfd8ac

Please sign in to comment.