x x x
Only portrait mode is currently supported - please rotate your device.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HTML
<script>
const replaceDates = () => {
  let upcomingEventsSection = document.getElementById("scroll-section-1");
  let upcomingEventsCards = Array.from(upcomingEventsSection.getElementsByClassName("eventcard"));

  for (let i = 0; i < upcomingEventsCards.length; i++) {
    let card = upcomingEventsCards[i];
    let UTCdate = parseInt(card.dataset.startdate);
    console.log("Start Date:", UTCdate);

    let localDateStr = new Date(UTCdate).toLocaleString();
    console.log("localDateStr:", localDatelocalDateStr);
    let localDate = new Date(localDateStr);
    console.log("localDate:", localDate);

    formatDate2(localDate).then(datetimeStr => {
      console.log("datetimeStr:", datetimeStr);
      datetimeStr = datetimeStr.split(" on ");
      let timeStr = datetimeStr[0];
      let dateStr = datetimeStr[1];

      card.getElementsByClassName("formattedDatetime")[0].innerText = timeStr;
      card.getElementsByClassName("formattedDate")[0].innerText = dateStr;
    });
  };
}

window.addEventListener('load', () => {
	replaceDates();
});
</script>

...