google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

Timezone issue when trying to patch google tasks item

Open longfangsong opened this issue 1 year ago • 0 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

  • Search the issues already opened: https://github.com/googleapis/google-api-python-client/issues
  • Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: macOS 15.1.1 (24B91), arm64
  • Python version: Python 3.13.0
  • pip version: pip 24.2
  • google-api-python-client version: 2.155.0

Steps to reproduce

  1. Patch an item in a google tasks list with api
  2. Read the result

Code example

from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
creds = Credentials(TOKEN)
service = build('tasks', 'v1', credentials=creds)

result = service.tasks().patch(
            tasklist="ZERNSFhRUWduTVFuOVV0UQ",
            task="elo1NllBMlJ4TERCZ3Nucg",
            body={'title': 'Subitem', 'status': 'needsAction', 'due': '2024-12-14T00:00:00+01:00', 'notes': None, 'parent': 'OXRUelVzcFNjYWphbTl6Wg'},
        ).execute()
print(result)

Note the timestamp is 2024-12-14T00:00:00+01:00.

The result is:

{'kind': 'tasks#task', 'id': 'elo1NllBMlJ4TERCZ3Nucg', 'etag': '"LTExNjY2OTMyNjc"', 'title': 'Subitem', 'updated': '2024-12-12T10:41:34.000Z', 'selfLink': 'https://www.googleapis.com/tasks/v1/lists/ZERNSFhRUWduTVFuOVV0UQ/tasks/elo1NllBMlJ4TERCZ3Nucg', 'parent': 'OXRUelVzcFNjYWphbTl6Wg', 'position': '00000000000000000000', 'status': 'needsAction', 'due': '2024-12-13T00:00:00.000Z', 'links': [], 'webViewLink': 'https://tasks.google.com/task/zZ56YA2RxLDBgsnr?sa=6'}

Note the timestamp is 2024-12-13T00:00:00.000Z.

Stack trace

NA

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

longfangsong avatar Dec 12 '24 10:12 longfangsong