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 Answer