Skip to content

Commit

Permalink
fix: intervention data load in edit panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaëtan committed Aug 21, 2021
1 parent 0f2054a commit 443b108
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions frontend/components/Form/useDate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ const DatePicker: React.FC<DatePickerProps> = ({
<Controller
control={control}
name={name}
defaultValue={new Date()}
defaultValue={""}
render={({ onChange, value }) => (
<>
<KeyboardDatePicker
disableToolbar
disableToolbar={false}
fullWidth
variant="dialog"
inputVariant="outlined"
format={setLocaleFormat(router.locale)}
margin="dense"
label={label}
value={value ? value : new Date()}
value={value ? value : ""}
onChange={onChange}
InputLabelProps={{ shrink: true }}
error={Boolean(error)}
Expand Down
3 changes: 1 addition & 2 deletions frontend/components/Interventions/Panel/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ const InterventionPanelHeader: FC<InterventionPanelHeaderProps> = ({
const periodDate =
!intervention.done &&
!intervention.properties.cancelled &&
intervention.intervention_start_date &&
intervention.intervention_end_date
intervention.intervention_start_date
? `Prévue pour le ${new Date(
intervention.intervention_start_date
)?.toLocaleDateString()}`
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Interventions/Panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const InterventionsEdit: FC<IInterventionEditProps> = () => {

useEffect(() => {
const { query, route } = router;

setIntervention(undefined);
if (
route === "/[organizationSlug]/map" &&
query.panel === "intervention-edit" &&
Expand Down

0 comments on commit 443b108

Please sign in to comment.