Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active November 3, 2018 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsrath/1e02fcea1fe588fe663ef971372cd7b5 to your computer and use it in GitHub Desktop.
Save jsrath/1e02fcea1fe588fe663ef971372cd7b5 to your computer and use it in GitHub Desktop.
async function getData(event) {
event.preventDefault();
document.querySelector('.output').classList.add('visible');
let createdDate;
let data = [];
const user = document.getElementById('username').value;
await fetch(`https://api.github.com/users/${user}`)
.then(response => response.json())
.then(response => (createdDate = response.created_at));
const createdDay = new Date(createdDate).getMonth();
const createdMonth = new Date(createdDate).getDate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment