Sha256: 08a7d46df16c42d5918ea3853a9035a0fb35ecec2553b8c196b8c4446883c8ec
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
<script> function capitalize(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function monthName(date, locale, type){ name = date.toLocaleString(locale, { month: type }); return capitalize(name); } function parseDate(date){ return date.getDate() + " / " + monthName(date, 'es-MX', "short") + " / " + date.getFullYear() + " " + ((date.getHours()%12)?(date.getHours()%12):12) + ":" + (date.getMinutes()<10?'0':'') + date.getMinutes() + (date.getHours()>=12?' PM':' AM'); } getRealtimeExchangeRates = function() { const docRef = firestoredb.doc("exchange-rates/usd"); const usdSell = document.querySelector("#sell-usd-exchange-rates"); const usdUpdatedAt = document.querySelector("#updated-at-usd-exchange-rates"); docRef.onSnapshot(function (doc){ if (doc && doc.exists) { const data = doc.data(); usdSell.innerText = "USD: " + data.sell.toFixed(2); usdUpdatedAt.innerText = parseDate(new Date(data.updated_at.toDate())); } }); } getRealtimeExchangeRates(); </script>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-theme-marketing-1.0.1 | _includes/components/exchange-rates/progressive.js |
jekyll-theme-marketing-1.0.0 | _includes/components/exchange-rates/progressive.js |