INNER CODE UNIT · JavaScript

secondsRemaining

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

  const secondsRemaining = (currentPeriod.start + currentPeriod.long) * 60
    - (currentMinutes * 60 + currentDate.getSeconds());
  const isCountdownPeriod = currentPeriod.long > 30
    && /^(P[1-6]|A)$/.test(currentPeriod.name);
  const showSeconds = isCountdownPeriod
    && secondsRemaining > 0
    && secondsRemaining <= 60;
  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() {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…