From 83366605d1bd43c245c4c110fadfd1a6fd05d3c2 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 20 Oct 2022 15:31:05 +1100
Subject: Add gcal to client-side HistDates

Add YearDate and CalDate
Restrict non-calendar HistDates to years before 4713 BC
---
 src/App.vue | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 4eed256..c3cf6bf 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -39,7 +39,7 @@ import PlusIcon from './components/icon/PlusIcon.vue';
 import SettingsIcon from './components/icon/SettingsIcon.vue';
 import HelpIcon from './components/icon/HelpIcon.vue';
 // Other
-import {HistDate, TimelineState, HistEvent, queryServer, HistEventJson, jsonToHistEvent, cmpHistEvent,
+import {HistDate, YearDate, TimelineState, HistEvent, queryServer, HistEventJson, jsonToHistEvent, cmpHistEvent,
 	timeout} from './lib';
 import {useStore} from './store';
 import {RBTree, rbtree_shallow_copy} from './rbtree';
@@ -109,7 +109,7 @@ function cmpDatePairs(datePair1: [HistDate, HistDate], datePair2: [HistDate, His
 }
 function isExhaustedRange(startDate: HistDate, endDate: HistDate): boolean {
 	// Check if input range is contained in a stored exhausted range
-	let itr = exhaustedRanges.lowerBound([startDate, new HistDate(1)]);
+	let itr = exhaustedRanges.lowerBound([startDate, new YearDate()]);
 	let datePair = itr.data();
 	if (datePair == null){
 		datePair = itr.prev();
@@ -129,7 +129,7 @@ function isExhaustedRange(startDate: HistDate, endDate: HistDate): boolean {
 function addExhaustedRange(startDate: HistDate, endDate: HistDate){
 	let rangesToRemove: HistDate[] = []; // Holds starts of ranges to remove
 	// Find ranges to remove
-	let itr = exhaustedRanges.lowerBound([startDate, new HistDate(1)]);
+	let itr = exhaustedRanges.lowerBound([startDate, new YearDate()]);
 	let prevRange = itr.prev();
 	if (prevRange != null){ // Check for start-overlapping range
 		if (prevRange[1].isEarlier(startDate)){
@@ -153,7 +153,7 @@ function addExhaustedRange(startDate: HistDate, endDate: HistDate){
 	}
 	// Remove included/overlapping ranges
 	for (let start of rangesToRemove){
-		exhaustedRanges.remove([start, new HistDate(1)]);
+		exhaustedRanges.remove([start, new YearDate()]);
 	}
 	// Add possibly-merged range
 	if (prevRange != null){
-- 
cgit v1.2.3

