2

I am trying to insert new task with due date and time in Google Tasks using Tasks Service. The issue i am facing is that date is setting correctly while time is not setting. The code is given below:

I had tried all the solutions given on stackoverflow and other platform, none of them worked.

      var task = Tasks.newTask().setTitle(data[i]);
      task.setDue("2019-6-25T10:10:10.000Z");
      Tasks.Tasks.insert(task, taskList.id);

I expect both the date and time to be set but only date is setting.

Sohail Malik
  • 305
  • 1
  • 2
  • 12
  • You can vote on Google's public issue tracker to make this data accessible via the API. The issue is here: https://issuetracker.google.com/issues/128979662. You can vote on the issue if you are affected by it. – zr0gravity7 Dec 19 '21 at 18:12

1 Answers1

3

The official document says as follows.

Due date of the task (as a RFC 3339 timestamp). Optional. The due date only records date information; the time portion of the timestamp is discarded when setting the due date. It isn't possible to read or write the time that a task is due via the API.

Unfortunately, in the current stage, by above specification, even if 2019-6-25T10:10:10.000Z is used for due, it becomes 2019-06-25T00:00:00.000Z. So it seems that in order to modify the time, it is required to manually modify it.

Reference:

Tanaike
  • 181,128
  • 11
  • 97
  • 165