Skip to content

Commit

Permalink
Merge pull request #2 from tylerl0706/patch-1
Browse files Browse the repository at this point in the history
Switch usage of .toISOString() to getting local date.
  • Loading branch information
orviwan authored Jan 15, 2018
2 parents 94cd8c8 + 5d9cfd4 commit a4ef486
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion companion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { settingsStorage } from "settings";

// Fetch Sleep Data from Fitbit Web API
function fetchSleepData(accessToken) {
let todayDate = new Date().toISOString().slice(0,10); //YYYY-MM-DD
let date = new Date();
let todayDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; //YYYY-MM-DD

// Sleep API docs - https://dev.fitbit.com/reference/web-api/sleep/
fetch(`https://api.fitbit.com/1.2/user/-/sleep/date/${todayDate}.json`, {
Expand Down

0 comments on commit a4ef486

Please sign in to comment.