Skip to content

Commit

Permalink
fix(timeRange): shiftArray should not mutate its argument (#2420)
Browse files Browse the repository at this point in the history
  • Loading branch information
wirhabenzeit committed Nov 14, 2023
1 parent 1620db2 commit e4a343f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/calendar/src/compute/timeRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,8 @@ const getTimeInterval = (firstWeekday: Weekday) => {
function shiftArray<T>(arr: T[], x: number): T[] {
if (!arr.length || !x) return arr

for (let i = 0; i < x; i++) {
const shifted = arr.shift() as T
arr.push(shifted)
}

return arr
x = x % arr.length
return arr.slice(x, arr.length).concat(arr.slice(0, x))
}

function computeGrid({
Expand Down

1 comment on commit e4a343f

@vercel
Copy link

@vercel vercel bot commented on e4a343f Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nivo – ./

nivo-git-master-plouc.vercel.app
www.nivo.rocks
nivo-plouc.vercel.app
nivo.vercel.app
nivo.rocks

Please sign in to comment.