// Name: What time is it
// Description: View current time in a few timezones that I care about
// Author: Francois Buys
// Github: fbuys
import "@johnlindquist/kit"
let estTime = await get("https://timeapi.io/api/Time/current/zone?timeZone=America/New_York")
let baTime = await get("https://timeapi.io/api/Time/current/zone?timeZone=America/Argentina/Buenos_Aires")
let brTime = await get("https://timeapi.io/api/Time/current/zone?timeZone=America/Sao_Paulo")
let { format } = await npm("date-fns")
const formatString = "eeee, h:mm aaa"
const local = format(new Date(), formatString)
const est = format(new Date(estTime.data["dateTime"]), formatString)
const ba = format(new Date(baTime.data["dateTime"]), formatString)
const br = format(new Date(brTime.data["dateTime"]), formatString)
await div(`
<p>πΏπ¦ My Time is <strong>${local}</strong></p>
<p>πΊπΈ Time in EST zone is <strong>${est}</strong></p>
<p>π¦π· Time in Argentina is <strong>${ba}</strong></p>
<p>π§π· Time in Brazil is <strong>${br}</strong></p>
`, 'p-10')