10-02-2020 15:48
10-02-2020 15:48
I keep getting the following error:
Unhandled Exception: TypeError: Cannot read property 'adjusted' of undefined.
The steps aren't visible on the clock face either.
I'm using the following code:
index.view:
<section x="85%" y="10%" width="80" height="20">
<image id="stepsIcon"/>
<text id="stepsLabel"/>
</section>
style.css
#stepsLabel {
font-size: 25;
font-family: System-Bold;
text-length: 32;
text-anchor: end;
x: -10;
fill: antiquewhite;
}
index.js
import { today } from "user-activity";
const stepsLabel = document.getElementById("stepsLabel");
clock.ontick = (evt) => {
if (appbit.permissions.granted("access_activity")) {
stepsLabel.text=`${today.adjusted.steps}`;
}
showDate(evt)
let today = evt.date;
let hours = today.getHours();
if (preferences.clockDisplay === "12h") {
// 12h format
hours = hours % 12 || 12;
} else {
// 24h format
hours = util.zeroPad(hours);
}
let mins = util.zeroPad(today.getMinutes());
myLabel.text = `${hours}:${mins}`;
}
I'm sure it's something simple I'm missing, I just can't seem to lock it in though. Any help is highly appreciated.
Thanks in advance!
Answered! Go to the Best Answer.
10-02-2020 15:56
10-02-2020 15:56
You're using the variable name 'today' for two different things.
10-02-2020 15:56
10-02-2020 15:56
You're using the variable name 'today' for two different things.
10-02-2020 16:37
10-02-2020 16:37
I knew it was something simple. Thank you so much for your help!