From ee935784ccdf6e75a853f80b78dac6bf7fb95fbe Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 4 Jan 2023 11:44:51 +1100
Subject: Remove server-side conversion of YearDates >4713 BC to CalDates

The conversion was originally intended to simply the code.  But,
as events may span years before and after 4713 BC, the conversion
introduces the possibility of having both YearDates and CalDates
in the same event, which is unhelpful.
---
 src/components/TimeLine.vue | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/components/TimeLine.vue')

diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index 5a69f3f..a2c77a3 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -666,16 +666,17 @@ const tickToCount = computed((): Map<number, number> => {
 	}
 	const map = props.unitCountMaps[minorScaleIdx.value];
 	for (let tickIdx = firstIdx.value; tickIdx < lastIdx.value; tickIdx++){
-		tickToCount.set(tickIdx, 0);
+		let eventCount = 0;
 		let date = ticks.value[tickIdx].date.clone();
 		let nextDate = ticks.value[tickIdx + 1].date;
 		while (date.isEarlier(nextDate)){
 			let unit = dateToUnit(date, minorScale.value);
 			if (map.has(unit)){
-				tickToCount.set(tickIdx, tickToCount.get(tickIdx)! + map.get(unit)!);
+				eventCount += map.get(unit)!;
 			}
 			stepDate(date, minorScale.value, {inplace: true});
 		}
+		tickToCount.set(tickIdx, eventCount);
 	}
 	return tickToCount;
 });
-- 
cgit v1.2.3

