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