Basic Utility Functions Written.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -76,3 +76,4 @@ typings/ | ||||
| # FuseBox cache | ||||
| .fusebox/ | ||||
|  | ||||
| out/ | ||||
							
								
								
									
										17
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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>/**" | ||||
|             ] | ||||
|         } | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										35
									
								
								index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -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}`; | ||||
| } | ||||
							
								
								
									
										9
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|     "compilerOptions": { | ||||
|         "target": "ES5", | ||||
|         "module": "CommonJS", | ||||
|         "outDir": "out", | ||||
|         "sourceMap": true | ||||
|     }, | ||||
|     "compileOnSave": true | ||||
| } | ||||
		Reference in New Issue
	
	Block a user