05-23-2018 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Would it be possible to create a countdown watch face? ”100 years” minus ”the users current age” ticking down.
And if so can someone clever help me with the code?

05-23-2018 12:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 12:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sould count down to the day that they turn 100 (or any other date)? I think this would be a better app than watch face; but I think it is easy to do.
Best Answer05-23-2018 12:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 12:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Exactly – a countdown to the day they turn 100. I kind of like the idea of having it as a clock face and not an app – a constant reminder of life passing instead of moving forward. Any ideas on where I should start? I’m a designer, but a programming noob.
Best Answer05-23-2018 13:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 13:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
If you can wait until this evening, I can put the start of a project up on github that you/we can work off of.... Otherwise start the basic clock project on studio.fitbit.com
Best Answer05-23-2018 15:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 15:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Here is a basic version of the main code:
import clock from "clock";
import document from "document";
import { preferences } from "user-settings";
import * as util from "../common/utils";
// Update the clock every second
clock.granularity = "seconds";
// Get a handle on the <text> element
const myLabel = document.getElementById("myLabel");
//This is the target
//This could be entered through the settings
// or by using the web API to poll the user DOB and adding 100 to the years.
let end = new Date("2082-12-03");
// Update the <text> element every tick with the current time
clock.ontick = (evt) => {
//Now Date/time
let today = evt.date;
//Difference in miliseconds
let diff = Math.abs(end - today);
let years = parseInt(diff / 31536000000);
diff -= years * 31536000000;
let days = parseInt(diff / 86400000);
diff -= days * 86400000
let hours = parseInt(diff / 3600000)
diff -= hours * 3600000
let mins = parseInt(diff / 60000)
diff -= mins * 60000
let secs = parseInt(diff / 1000)
diff -= secs * 1000
console.log()
myLabel.text = util.zeroPad(years) + ":" + util.zeroPad(days) + ":" + util.zeroPad(hours) + ":" + util.zeroPad(mins) + ":" + util.zeroPad(secs);
}Let me know if you want to know more, work together, etc.
05-23-2018 15:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 21:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-23-2018 21:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Wow! I’m speechless – magic happens when I sleep. I’ll get back to you ...
Thanks!
Best Answer05-24-2018 01:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more
05-24-2018 03:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-24-2018 03:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
want just the whole number part of the division, then I remove it and take
the next biggest chunk.
Best Answer05-24-2018 08:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-24-2018 08:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks again! You kickstarted me into actually getting somewhere with the idea – I’ll keep playing with the clock face during the weekend.
So far I’ve mono spaced the digits and I’m toying with animations ... I’ll keep you posted.
Best Answer05-24-2018 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-24-2018 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Good to hear. Feel free to message me if you have any questions. If you don't mind; I might work on an app version that does arbitrary events.
Best Answer05-24-2018 13:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
05-24-2018 13:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Looking forward to see your app.
Best Answer08-01-2018 05:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
11-30-2018 06:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
11-30-2018 06:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm using your code from this post in a Christmas countdown app I'm working on. I noticed that it is using UTC time. Is there a quick way to make it use the correct time for the user's timezone? For example it's running 8 hours ahead of my time(PST). Might be a simple fix, I'm not very savvy with writing code. Thanks for the help.
Best Answer11-30-2018 08:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
11-30-2018 08:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
It seems that you will have to use the companion to do this:
https://community.fitbit.com/t5/SDK-Development/Force-companion-to-pass-info/m-p/3010132#M6532).%C2%...
I can see about writing an example to do this tonight maybe.
11-30-2018 08:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
11-30-2018 08:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you, any help is appreciated.
I don't know much about coding but I learn well from examples, trial/error.
Best Answer07-01-2023 20:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
07-01-2023 20:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi, wondering how everything turned out with this code. I have wanted to build the same function as well. Was it successful? Can a newbie successfully implement it?
Best Answer07-01-2023 21:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more
07-01-2023 21:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
07-01-2023 21:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Pretty easy if I remember correctly – it has been a few years and my fitbit died long before me.
Best Answer07-02-2023 15:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
07-02-2023 15:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sent from my iPhone
Best Answer