diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-02 14:51:53 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-02 14:51:53 +1100 |
| commit | 56369bccd977ac726bef70895883e79da4e1edd8 (patch) | |
| tree | 67a894fe1579f2da150f0162ccbdc8a0a19ef9be /src | |
| parent | 0e5e46cedaaeacf59cfd0f2e30c1ae6923466870 (diff) | |
Adjust wikidata event specifiers
Do minor refactors:
- Swap fmt=1 and fmt=2 in 'events' table
- Make documentation consistently use BC and AD
- import argparse at start of scripts
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/TimeLine.vue | 6 | ||||
| -rw-r--r-- | src/lib.ts | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue index 1e78a87..c869aa3 100644 --- a/src/components/TimeLine.vue +++ b/src/components/TimeLine.vue @@ -245,7 +245,7 @@ class Tick { } function getNumDisplayUnits({inclOffsets=true} = {}): number { // Get num major units in display range let unitDiff = Math.ceil(getUnitDiff(startDate.value, endDate.value, scale.value)); - // Note: Rounding up due to cases like 1 CE to 10 CE with 10-year scale + // Note: Rounding up due to cases like 1 AD to 10 AD with 10-year scale if (inclOffsets){ unitDiff += startOffset.value + endOffset.value; } @@ -886,7 +886,7 @@ function zoomTimeline(zoomRatio: number){ newStartOffset /= oldUnitsPerNew; newEndOffset /= oldUnitsPerNew; // Shift starting and ending points to align with new scale - // Note: There is some distortion due to not fully accounting for no year 0 CE here, + // Note: There is some distortion due to not fully accounting for no year 0 AD here, // but the result seems tolerable, and resolving it adds a fair bit of code complexity let newStartSubUnits = (scale.value == DAY_SCALE) ? getDaysInMonth(newStart.year, newStart.month) : @@ -929,7 +929,7 @@ function zoomTimeline(zoomRatio: number){ } else { newStart.year = Math.floor(newStart.year / newScale) * newScale; newEnd.year = Math.floor(newEnd.year / newScale) * newScale; - // Account for no 0 CE + // Account for no 0 AD if (newStart.year == 0){ newStart.year = 1; } @@ -150,7 +150,7 @@ export class HistDate { } getYearDiff(other: HistDate){ let yearDiff = Math.abs(this.year - other.year); - if (this.year * other.year < 0){ // Account for no 0 CE + if (this.year * other.year < 0){ // Account for no 0 AD yearDiff -= 1; } return yearDiff; @@ -418,7 +418,7 @@ export function stepDate( // If stepping by month or years, leaves day value unc let newYear; if (forward){ newYear = newDate.year + count*scale; - if (newYear == 0){ // Account for there being no 0 CE + if (newYear == 0){ // Account for there being no 0 AD newYear = 1; } else if (newDate.year == 1 && scale > 1){ newYear -= 1; @@ -471,7 +471,7 @@ export function getNumSubUnits(date: HistDate, scaleIdx: number){ } else if (scale == 1){ return 12; } else { - return scale / SCALES[scaleIdx + 1] - (date.year == 1 ? 1 : 0); // Account for lack of 0 CE + return scale / SCALES[scaleIdx + 1] - (date.year == 1 ? 1 : 0); // Account for lack of 0 AD } } export function getUnitDiff(date: HistDate, date2: HistDate, scale: number): number { |
