Skip to content

Commit

Permalink
fix RegularSchedulePicker for all timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
celineung committed Dec 19, 2024
1 parent c745c1b commit a5b68ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
calculateNumberOfWorkedDays,
calculateTotalImmersionHoursFromComplexSchedule,
calculateWeeklyHoursFromSchedule,
convertLocaleDateToUtcTimezoneDate,
regularTimePeriods,
selectedDaysFromComplexSchedule,
} from "shared";
Expand Down Expand Up @@ -122,8 +123,10 @@ export const RegularSchedulePicker = (props: RegularSchedulePickerProps) => {
<WeeksHoursIndicator
schedule={values.schedule}
interval={{
start: new Date(values.dateStart),
end: new Date(values.dateEnd),
start: convertLocaleDateToUtcTimezoneDate(
new Date(values.dateStart),
),
end: convertLocaleDateToUtcTimezoneDate(new Date(values.dateEnd)),
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SelectedDaysOfTheWeekDto,
WeekdayNumber,
arrayFromNumber,
convertLocaleDateToUtcTimezoneDate,
frenchDayMapping,
maximumCalendarDayByInternshipKind,
removeAtIndex,
Expand Down Expand Up @@ -49,8 +50,12 @@ export const WeekdayPicker = ({
const uniqueWeekDaysOnInterval = uniq(
arrayFromNumber(startEndDiff + 1).map(
(dayIndex) =>
frenchDayMapping(addDays(new Date(start), dayIndex).toISOString())
.frenchDay,
frenchDayMapping(
addDays(
convertLocaleDateToUtcTimezoneDate(new Date(start)),
dayIndex,
).toISOString(),
).frenchDay,
),
);
return !uniqueWeekDaysOnInterval.includes(day);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export const ScheduleSection = () => {

<SchedulePicker
interval={{
start: new Date(values.dateStart),
end: new Date(values.dateEnd),
start: convertLocaleDateToUtcTimezoneDate(new Date(values.dateStart)),
end: convertLocaleDateToUtcTimezoneDate(new Date(values.dateEnd)),
}}
excludedDays={excludedDays}
/>
Expand Down

0 comments on commit a5b68ba

Please sign in to comment.