#40Digital Segment Clock
Overview
Build a real-time digital clock using seven-segment-style digits.
Requirements
- Render the current time using
SevenSegmentDigitfor each number andColonbetween 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 secondandchecks 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
SevenSegmentDigitto understand how it works. - Be careful when implementing the
getDigits()function; the format must match'HHMMSS'for the digits.
Tests
- renders the app title
- renders all 6 digits and 2 colons
- renders correct segments for each digit 0
- renders correct segments for each digit 1
- renders correct segments for each digit 2
- renders correct segments for each digit 3
- renders correct segments for each digit 4
- renders correct segments for each digit 5
- renders correct segments for each digit 6
- renders correct segments for each digit 7
- renders correct segments for each digit 8
- renders correct segments for each digit 9
- updates the clock digits every second
- checks getDigits return 6 digits array