cbrooker / MMM-Todoist

This is an extension for the MagicMirror2 platform. It will display your Todoist todos on your MagicMirror.
MIT License
151 stars 56 forks source link

Timezone issue? #69

Open HackMasterFlash opened 4 years ago

HackMasterFlash commented 4 years ago

My raspberry pi has the timezone set for New York and displays time correctly. I have my ToDoist account in the same time zone. But the MM module is showing list items with the incorrect due date. Example an item due on 3/20 (today) is saying it was due yesterday. Is this a UTC issue?

gonzonia commented 4 years ago

I'm having the same issue.

cbrooker commented 4 years ago

I'll try to get this resolved today. I think MM changed the way they handle time zones.

gonzonia commented 4 years ago

I'm actually trying to figure it out now. The problem happens when you convert item.due.date returns 2020-03-23 but dueDateTime returns Sun Mar 22 2020 20:00:00 GMT-0400 (EDT)

dueDateTime is the result of var dueDateTime = new Date(item.due.date);

xozai commented 4 years ago

I am having the same issue.

bonochromatic commented 4 years ago

I'll chime in - I'm seeing the same issue. I'm expecting to see today's tasks (and my overdue's), but instead I'm seeing today's and tomorrow's, with today's showing as "yesterday" and tomorrow's showing as "today." Aligns with what gonzonia mentioned up above. Did any of you manage to figure it out yet?

Or...am I seeing a new occurrence of an already-solved issue?

gonzonia commented 4 years ago

No, it's still going on. I go in and add a + 1 to the diffDays calculation everytime there's a new update to the module. It's a minor tweak and not worth forking for. I'm not sure why it's even happening.

smartbrain83 commented 4 years ago

I am also experiencing this issue. When a add a task for today it shows up in MM as being due yesterday.

@gonzonia -- where at exactly did you add "+1" to diffDays? Was it under the "if (self.config.displayTasksWithinDays..." statement or under the "autoDueDateCell" function?

gonzonia commented 4 years ago

In MMM-Todoist.js I changes line 457 to var diffDays = Math.floor((dueDate - today + 7200000) / (oneDay))+1;

diego-escalante commented 4 years ago

I have an open pull request that will fix this, I believe. The issue is that tasks with only a due day are relative to UTC time, whereas tasks with a due day and time are (correctly) interpreted relative to your local timezone.

deyawper commented 4 years ago

This resolved the floating timezone issue but if the timezone is chosen in Todoist (i.e. not the floating default), due times are now off.

diego-escalante commented 4 years ago

@deyawper, you are right. I forgot to take into account set timezones. Looks like Todoist returns due dates with timezones set as UTC in zulu format. I made another pull request to take this into account.