INNER CODE UNIT · JavaScript

hours

landgreen/landgreen.github.io · bells/index.js:1427

  const hours = (currentDate.getHours() - 1) % 12 + 1;
  const minutes = String(currentDate.getMinutes()).padStart(2, "0");
  const seconds = String(currentDate.getSeconds()).padStart(2, "0");

  return {
    text: `${hours}:${minutes}${showSeconds ? `:${seconds}` : ""}`,
    showSeconds
  };
}

function drawDigitalClock() {
  date = new Date();
  const clockDisplay = getClockDisplay(date);
  const clock = document.getElementById("time");
  clock.textContent = clockDisplay.text;
  clock.setAttribute("font-size", clockDisplay.showSeconds ? "43px" : "55px");
  // document.getElementById("week-day").textContent = dayOfWeekAsString(date.getDay());
  // document.getElementById("date").textContent = nameOfMonthAsString(date.getMonth()) + " " + date.getDate();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…