Skip to content

Commit

Permalink
Merge pull request #669 from NBISweden/hotfix/fix-edit-bug
Browse files Browse the repository at this point in the history
Fix edit period date picking conflict
  • Loading branch information
kusalananda authored Sep 23, 2022
2 parents 46d35b9 + b6ee98e commit d1f30a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 11 additions & 2 deletions frontend/src/components/EditPeriodDialogProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const EditPeriodDialogProvider = ({ children }) => {
const UpdateAbsenceRangesContainer = (): JSX.Element => (
<div>
<p>Please enter below the new start and end date of your absence.</p>
<p>From</p>
<hr></hr>
<label htmlFor="fromDate" className="date-label">
Start date
</label>
<DatePicker
filterDate={isWeekday}
dateFormat={dateFormat}
Expand All @@ -46,8 +49,12 @@ export const EditPeriodDialogProvider = ({ children }) => {
startDate={updatedAbsenceStartDate}
endDate={updatedAbsenceEndDate}
monthsShown={1}
placeholderText="YYYY-MM-DD"
strictParsing
/>
<p>To</p>
<label htmlFor="toDate" className="date-label">
End date
</label>
<DatePicker
filterDate={isWeekday}
dateFormat={dateFormat}
Expand All @@ -66,6 +73,8 @@ export const EditPeriodDialogProvider = ({ children }) => {
startDate={updatedAbsenceStartDate}
endDate={updatedAbsenceEndDate}
monthsShown={1}
placeholderText="YYYY-MM-DD"
strictParsing
/>
</div>
);
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/pages/AbsencePlanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,7 @@ export const AbsencePlanner = () => {
// We need to find a solution for better user feedback before enabling it again for that use case.

const isDayEnabled = (date: Date) => {
return (
!reportedDates.includes(formatDate(date, dateFormat)) && isWeekday(date)
);
return isWeekday(date);
};

const context = React.useContext(AuthContext);
Expand Down Expand Up @@ -788,8 +786,8 @@ export const AbsencePlanner = () => {
toggleLoadingPage(true);
onUpdateAbsenceRanges(
element.entryIds,
new Date("2023-01-03"),
new Date("2023-01-03")
element.startDate,
element.endDate
);
toggleLoadingPage(false);
}}
Expand Down

0 comments on commit d1f30a4

Please sign in to comment.