Skip to content

Commit 41b660c

Browse files
- FIX: Fixed timezone related issues with heatmap timepoint selector.
1 parent c2888cd commit 41b660c

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/components/chart/FieldLayoutHeatmap.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,25 +511,22 @@
511511
if (!newValue.allowRepeats || !td) {
512512
timepoints.value = []
513513
} else {
514-
const tp: number[] = []
514+
const tp: string[] = []
515515
Object.keys(td).forEach(k => {
516516
const traitData = td[k]?.measurements[newValue.id || '']
517517
if (traitData) {
518518
traitData.forEach(dp => {
519519
if (dp.timestamp) {
520520
const date = new Date(dp.timestamp)
521-
date.setHours(0, 0, 0, 0)
522-
tp.push(date.getTime())
521+
tp.push(date.toISOString().split('T')[0] || '')
523522
}
524523
})
525524
}
526525
})
527526
528-
tp.sort((a, b) => a - b)
529-
530-
const set = new Set<string>()
531-
tp.forEach(dp => set.add(toLocalDateString(new Date(dp))))
527+
tp.sort((a, b) => a.localeCompare(b))
532528
529+
const set = new Set<string>(tp)
533530
timepoints.value = [...set]
534531
currentTimepoint.value = timepoints.value.length - 1
535532
}

src/components/chart/ReplicateHeatmap.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,25 +560,22 @@
560560
if (!newValue.allowRepeats || !td) {
561561
timepoints.value = []
562562
} else {
563-
const tp: number[] = []
563+
const tp: string[] = []
564564
Object.keys(td).forEach(k => {
565565
const traitData = td[k]?.measurements[newValue.id || '']
566566
if (traitData) {
567567
traitData.forEach(dp => {
568568
if (dp.timestamp) {
569569
const date = new Date(dp.timestamp)
570-
date.setHours(0, 0, 0, 0)
571-
tp.push(date.getTime())
570+
tp.push(date.toISOString().split('T')[0] || '')
572571
}
573572
})
574573
}
575574
})
576575
577-
tp.sort((a, b) => a - b)
578-
579-
const set = new Set<string>()
580-
tp.forEach(dp => set.add(toLocalDateString(new Date(dp))))
576+
tp.sort((a, b) => a.localeCompare(b))
581577
578+
const set = new Set<string>(tp)
582579
timepoints.value = [...set]
583580
currentTimepoint.value = timepoints.value.length - 1
584581
}

0 commit comments

Comments
 (0)