diff --git a/index.ts b/index.ts index 9489b85..ee87a91 100644 --- a/index.ts +++ b/index.ts @@ -4,6 +4,7 @@ * @license MIT * @version 2020.03.17 */ + import { addDays, format } from 'date-fns'; import cheerio from 'cheerio'; import axios from 'axios'; @@ -18,13 +19,13 @@ const WAIT = 500; // in ms // e.g https://trendogate.com/placebydate/23424977/2015-04-01 // Topic | Position | Date -const now: Date = new Date(); -let tmp : Date = now; +const goal: Date = new Date(2015, 2, 1); // 2 is March because Month is 0-indexed (why?) +let tmp : Date = new Date(); let days: Array = []; -for (let i = 0; i < NUMBER_OF_DAYS; i++) { - tmp = addDays(tmp, -1); +while (tmp >= goal) { days.push(tmp); + tmp = addDays(tmp, -7); } async function scrapeData() {