Skip to content

Commit a4ef486

Browse files
authored
Merge pull request #2 from tylerl0706/patch-1
Switch usage of .toISOString() to getting local date.
2 parents 94cd8c8 + 5d9cfd4 commit a4ef486

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

companion/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { settingsStorage } from "settings";
33

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

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

0 commit comments

Comments
 (0)