11-09-2020 21:11
11-09-2020 21:11
Currently, my app reports the total steps for a period from userActivity.today.adjusted["steps"]. I record the initial value and subtract it from the end value to get the total steps taken during the activity. I've been struggling to figure out how to make this work if someone starts an activity before midnight and completes it after. The userActivity.today.adjusted["steps"] resets to zero at midnight and I tried userActivity.yesterday.adjusted["steps"] but userActivity.yesterday is undefined. Is there an easy way to pull yesterday's totals? My plan B is to save and update max steps until steps is less than max steps (indicating the day changed).
Best Answer11-09-2020 21:39
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-09-2020 21:39
Perhaps not an easy way, but have a look at dayHistory.
11-10-2020 11:01
11-10-2020 11:01
Thanks! I was able to pull yesterday's data with:
let dayRecords = dayHistory.query();
let stepsYesterday = dayRecords[0].steps;