function parseDate(date) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
return months[date.getUTCMonth()] + ' ' + date.getUTCDate() + ', ' + date.getUTCFullYear() + ' ' + date.toLocaleTimeString();
}
function parseUser(user) {
const html = `
${user.first + ' ' + user.last}
Joined ${parseDate(new Date(user.date))}
Gender: ${user.gender}
Birthday: ${user.month + ' ' + user.day + ', ' + user.year}
`
return html
}
function render() {
const html = `
${data.users.map(u => parseUser(u)).join('')}
`
add(html, 'usres')
}
var data = {
users: []
}
async function load() {
const users = (await loadallusers()).json
console.log(users)
data.users = users
render()
}
header(false, true)
load()