Skip to content

Commit

Permalink
Fix duplicate shifts on mobile views
Browse files Browse the repository at this point in the history
If the calendar loaded the listWeek view by default, which it does on mobile, it was then switching the date for the calendar immediately after -- this was causing events to appear in the list twice. We now initialize the right start date for the listWeek view to stop this from happening.
  • Loading branch information
kitsuta committed Jan 21, 2025
1 parent 09b11a9 commit c0b4310
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion uber/templates/staffing/shifts.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ <h2 class="accordion-header" id="restricted-jobs-info-header">

const ec = new EventCalendar(document.getElementById('shift_cal'), {
view: window.matchMedia('(max-width: 576px)').matches ? 'listWeek' : 'timeGridWeek',
date: '{{ c.EPOCH.date() }}',
date: window.matchMedia('(max-width: 576px)').matches ? '{{ start }}' : '{{ c.EPOCH.date() }}',
allDaySlot: false,
highlightedDates: {{ highlighted_dates|safe }},
headerToolbar: {
Expand Down

0 comments on commit c0b4310

Please sign in to comment.