Basic Utility Functions Written.
This commit is contained in:
parent
a2c483e1b7
commit
0adcb77c12
|
@ -76,3 +76,4 @@ typings/
|
|||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
out/
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/out/index.js",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
const SITE_URL = "https://trendogate.com/";
|
||||
const NUMBER_OF_DAYS = 100;
|
||||
const USA_ID = 23424977;
|
||||
// https://trendogate.com/placebydate/23424977/2015-04-01
|
||||
|
||||
// Topic | Date | Position
|
||||
|
||||
// SO: https://stackoverflow.com/questions/4345045/javascript-loop-between-date-ranges/14655646
|
||||
const now: Date = new Date();
|
||||
let tmp : Date = now;
|
||||
let days: Array<Date> = [];
|
||||
|
||||
for (let i = 0; i < 100; i++) {
|
||||
tmp = new Date(tmp.getDate() - 1);
|
||||
days.push(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getNewDateURL(date: Date): String {
|
||||
let year: Number = date.getFullYear();
|
||||
let month: Number = date.getMonth();
|
||||
let day: Number = date.getDay();
|
||||
let monthFmt: String;
|
||||
let dayFmt: String;
|
||||
|
||||
if (month < 10) monthFmt = `0${month}`;
|
||||
else monthFmt = `${month}`;
|
||||
|
||||
if (day < 10) dayFmt = `0${day}`;
|
||||
else dayFmt = `${day}`;
|
||||
|
||||
return `${SITE_URL}/placebydate/${USA_ID}/${year}-${monthFmt}-${dayFmt}`;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "CommonJS",
|
||||
"outDir": "out",
|
||||
"sourceMap": true
|
||||
},
|
||||
"compileOnSave": true
|
||||
}
|
Reference in New Issue