aboutsummaryrefslogtreecommitdiff
path: root/src/components/TimeLine.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-10-14 17:52:29 +1100
committerTerry Truong <terry06890@gmail.com>2022-10-14 17:52:29 +1100
commit4a0ffc55734adaaf3e9eacd9ee4bbc212e96a71e (patch)
treeb2d2df0175097c0e73c56d35e484a9685df7286e /src/components/TimeLine.vue
parent48d5f04d82cfd2e49644c2d5a55256b0088520b5 (diff)
Account for there being no year 0 CE
Diffstat (limited to 'src/components/TimeLine.vue')
-rw-r--r--src/components/TimeLine.vue4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue
index 01c937c..8c0bbb3 100644
--- a/src/components/TimeLine.vue
+++ b/src/components/TimeLine.vue
@@ -123,7 +123,7 @@ function initScale(){
}
function getYearlyScale(startDate: HistDate, endDate: HistDate, availLen: number){
// Get the smallest yearly scale that divides a date range, without making ticks too close
- let yearDiff = endDate.year - startDate.year;
+ let yearDiff = startDate.getYearDiff(endDate);
let idx = 0;
while (SCALES[idx] >= yearDiff){ // Get scale with units smaller than yearDiff
idx += 1;
@@ -160,7 +160,7 @@ function getNumVisibleUnits(): number {
} else if (scale.value == MONTH_SCALE){
numUnits = startDate.value.getMonthDiff(endDate.value);
} else {
- numUnits = (endDate.value.year - startDate.value.year) / scale.value;
+ numUnits = startDate.value.getYearDiff(endDate.value) / scale.value;
}
return numUnits + startOffset.value + endOffset.value;
}