Last active
January 24, 2018 12:19
-
-
Save theSekyi/4b2cf2d433c8997e3ce8a94f8762b255 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let currentYear = new Date().getFullYear(); | |
let currentDate = new Date(); | |
let currentMonth = currentDate.getUTCMonth() + 1; | |
let currentDay = currentDate.getUTCDate(); | |
let oldDay = currentDay - 2; | |
let newDay = currentDay - 1; | |
if (currentMonth < 10) { | |
currentMonth = '0' + currentMonth; | |
} | |
if (currentDay < 10) { | |
currentDay = '0' + currentDay; | |
} | |
let oldDate = oldDay + '-' + currentMonth + '-' + currentYear; | |
let newDate = newDay + '-' + currentMonth + '-' + currentYear; | |
let oldNavUrl = `http://217.17.20.226:8080/fam-rest/rest/api/eod?fundCode=ICAMGHRCF&valueDate=${oldDate}`; | |
let newNavUrl = `http://217.17.20.226:8080/fam-rest/rest/api/eod?fundCode=ICAMGHRCF&valueDate=${newDate}`; | |
// let navOld = fetch(oldNavUrl, { credentials: 'include' }) | |
// .then(response => response.json()) | |
// .then(data => { | |
// console.log(data); | |
// }); | |
let navOld = axios | |
.get(newNavUrl) | |
.then(function(response) { | |
console.log(response); | |
}) | |
.catch(function(error) { | |
console.log(error); | |
}); | |
navOld; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment