#40Digital Segment Clock
30min

Overview

Build a real-time digital clock using seven-segment-style digits.

Requirements

  • Render the current time using SevenSegmentDigit for each number and Colon between hours, minutes, and seconds.
  • Update the digits every second to reflect the current system time.
  • Convert the current time into digits with the helper function getDigits() and display them correctly. Keep it exported, as it is used in the tests.
  • Focus only on making the last 2 tests pass (updates the clock digits every second and checks getDigits return 6 digits array). The other 12 tests already pass.

Notes

  • All the markup and components are provided; just focus on the logic.
  • Take a look at SevenSegmentDigit to understand how it works.
  • Be careful when implementing the getDigits() function; the format must match 'HHMMSS' for the digits.

Tests

  1. renders the app title
  2. renders all 6 digits and 2 colons
  3. renders correct segments for each digit 0
  4. renders correct segments for each digit 1
  5. renders correct segments for each digit 2
  6. renders correct segments for each digit 3
  7. renders correct segments for each digit 4
  8. renders correct segments for each digit 5
  9. renders correct segments for each digit 6
  10. renders correct segments for each digit 7
  11. renders correct segments for each digit 8
  12. renders correct segments for each digit 9
  13. updates the clock digits every second
  14. checks getDigits return 6 digits array