Skip to content

Commit 239abc1

Browse files
committed
[fix] Update end date field requirement based on event type
Changes the requirement for the end date field in the event editor and new form to only be mandatory when the event type is Maintenance. This improves user experience by ensuring that the field is conditionally required, preventing unnecessary errors for other event types.
1 parent c13a38d commit 239abc1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Components/Event/EventEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function EventEditor({ Event }: { Event: Models.IEvent }) {
9898
<ScaleTextField
9999
type="datetime-local"
100100
label="(Plan) End CET"
101-
disabled={!(!IsIncident(State.type) || !IsOpenStatus(State.status))}
101+
required={State.type === EventType.Maintenance}
102102
value={State.end ? dayjs(State.end).format(Dic.Picker) : null}
103103
onScale-input={(e) => Actions.setEnd(new Date(e.target.value as string))}
104104
invalid={!!Validation.end}

src/Components/New/NewForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function NewForm() {
138138
<ScaleTextField
139139
type="datetime-local"
140140
label="(Plan) End CET"
141-
required
141+
required={State.type === EventType.Maintenance}
142142
value={State.end ? dayjs(State.end).format(Dic.Picker) : null}
143143
onScale-input={(e) => Actions.setEnd(new Date(e.target.value as string))}
144144
invalid={!!Validation.end}

0 commit comments

Comments
 (0)