10-04-2017 19:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-04-2017 19:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
New programmer here... I have created a clock face that has a primary time that is always displayed. Below that is either the UTC time or the date. What is displayed changes with .onclick. My problem is that I can only update one item based on clock.ontick. So, I can either update the primary time, the UTC time or the date. How do I update both clocks at the same time? My current work around is to force an update when I click on the element to show it again. My next feet of daring will be to add in a third option of displaying my current steps. I shouldn't have to cycle through for these items to update. Any help would be appreciated.
Jeff
Answered! Go to the Best Answer.

Accepted Solutions
10-05-2017 02:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-05-2017 02:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You should be able to move your logic inside a single update procedure, something like:
function updateClock() {
let today = new Date(); // Update primary time
// Update UTC time
// Update step count } clock.ontick = () => updateClock();

10-05-2017 02:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-05-2017 02:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You should be able to move your logic inside a single update procedure, something like:
function updateClock() {
let today = new Date(); // Update primary time
// Update UTC time
// Update step count } clock.ontick = () => updateClock();

10-05-2017 05:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-05-2017 05:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you. I knew there had to be an easy solution!

