From d48f3b862fad74af6576297d471d7834b1f0bba8 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 2 Jan 2023 17:47:38 +1100
Subject: Make baseline time-spans non-overlapping

Remove time-span labels
Fix firstDate/lastDate being passed to TimelineState instead of startDate/endDate
---
 src/App.vue | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 3de3ac2..b97e55a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -40,7 +40,7 @@ import SettingsIcon from './components/icon/SettingsIcon.vue';
 import HelpIcon from './components/icon/HelpIcon.vue';
 // Other
 import {timeout, HistDate, HistEvent, queryServer, EventResponseJson, jsonToHistEvent,
-	SCALES, TimelineState, cmpHistEvent, dateToUnit, DateRangeTree} from './lib';
+	SCALES, stepDate, TimelineState, cmpHistEvent, dateToUnit, DateRangeTree} from './lib';
 import {useStore} from './store';
 import {RBTree, rbtree_shallow_copy} from './rbtree';
 
@@ -126,9 +126,10 @@ function reduceEvents(){
 			continue;
 		}
 		// Look for units to keep
-		let scaleIdx: number = timeline.scaleIdx;
-		let startUnit = dateToUnit(timeline.startDate, SCALES[scaleIdx]);
-		let endUnit = dateToUnit(timeline.endDate, SCALES[scaleIdx]);
+		const scaleIdx = timeline.scaleIdx;
+		const scale = SCALES[scaleIdx];
+		let startUnit = dateToUnit(stepDate(timeline.startDate, scale, {forward: false}), scale);
+		let endUnit = dateToUnit(stepDate(timeline.endDate, scale), scale);
 		for (let [unit, count] of unitCountMaps.value[scaleIdx]){
 			if (unit >= startUnit && unit <= endUnit){
 				newMaps[scaleIdx].set(unit, count);
-- 
cgit v1.2.3

