function mergeChunks(newChunks, oldChunks) {
                                let currentDayFile = oldChunks
                                let chunksAfterCurrentDay

                                let lastChunk = oldChunks[oldChunks.length - 1]
                                let lastChunkBegin = new Date(lastChunk[0])
                                let lastChunkEnd = new Date(lastChunk[1])

                                let firstNewChunk = newChunks[0]
                                let firstNewChunkBegin = new Date(firstNewChunk[0]) 
                                let firstNewChunkEnd = new Date(firstNewChunk[1])

                                if (firstNewChunkBegin.getTime() ===  lastChunkBegin.getTime() &&
                                    firstNewChunkEnd.getTime() === lastChunkEnd.getTime()) {
                                        // Replace last min chunk with newly aggregated one
                                        currentDayFile.splice(-1, 1, firstNewChunk)
                                        newChunks.shift()
                                } 

                                for (let i = 0; i < newChunks.length; i++) {
                                    let currentChunk = newChunks[i]
                                    let currentChunkBegin = new Date(currentChunk[0])
                                    if (checkIfOnSameDay(lastChunkEnd, currentChunkBegin)) {
                                        currentDayFile.push(newChunks[i])
                                    } else {
                                        //TODO: test this branch
                                        chunksAfterCurrentDay = newChunks.slice(i)
                                        return [currentDayFile, chunksAfterCurrentDay]
                                    }
                                }

                                //If all chunks are on the same day then we will return the current day file and leave the chunks to sort as undefined
                                return [currentDayFile, undefined] 
                            }
The function merges new chunks of data with old chunks of data based on
their timestamps.
@param newChunks - An array of new chunks to be merged with the old
chunks.
@param oldChunks - An array of arrays representing one minute time intervals
(chunks). Each inner array has at least three elements: the start
time, end time, and data values of the chunk.
@returns an array with two elements: the first element is the current
day file (an array of chunks), and the second element is either an array
of chunks that come after the current day or undefined if all chunks are
on the same day.