Timezone of due_on

I have noticed that when we set due_at (date and time) for a task, API response gives an timestamp in UTC. But when we see due_on, this date stays in the user’s timezone. See the below screenshot
Screenshot 2021-06-15 at 4.44.01 AM

Do I need to fetch user’s timezone to convert it back to UTC OR its a bug in Asana API?

Two points:

  1. What you’re seeing is correct per the Asana API docs; if you check out those fields in the documentation for a task, you’ll see it says due_at is UTC time and due_on is local time.

  2. As it also says there, they should not be used together, only use one of them. The way I treat it is due_at always supercedes due_on. That is, if the user hasn’t set a specific time of day, then due_on will be set and due_at will not, so use due_on; if a specific time of day is set, then due_at will have a value, so use that and ignore due_on.

3 Likes

How do I convert the timezone to my local one within the due_at field? I tried several snippets and it is always overwritten and converted to UTC again.
I put the same code into the task description and it showed the right date and time. Has anyone experienced that?

Hi @Marie_Brandenburg,

I’m not sure I understand the question. due_at is in UTC within the Asana data store; you can’t supply it in your local time.