Skip to content

fix(tasks): clear due date when --due= is set to empty#507

Closed
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
dinakars777:fix/tasks-due-clear
Closed

fix(tasks): clear due date when --due= is set to empty#507
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
dinakars777:fix/tasks-due-clear

Conversation

@dinakars777
Copy link
Copy Markdown
Contributor

Summary

When gog tasks update --due= was used with an empty value, the due date was not actually cleared despite the help text stating "set empty to clear". The Google Tasks API PATCH treats an empty string the same as an omitted field due to omitempty JSON tagging, so the due date remained unchanged.

This fix adds "Due" to NullFields when the due value is empty, which forces the API to send an explicit null in the PATCH request body, properly clearing the due date.

Steps to Reproduce (before fix)

  1. Have a task with a due date set
  2. Run: gog tasks update <listId> <taskId> --due= --force
  3. Observe the due date is unchanged

Expected Behavior

The due date should be cleared (set to null).

Changes

  • When --due= is provided with an empty value, add "Due" to patch.NullFields instead of setting patch.Due = ""
  • Move the warnTasksDueTime call inside the non-empty branch since it's only relevant when a due date is being set

Test plan

  • go build ./... compiles cleanly
  • go test ./internal/cmd/... -run TestTasksValidation passes
  • Manual test: gog tasks update <listId> <taskId> --due= --force clears the due date
  • Manual test: gog tasks update <listId> <taskId> --due=2026-05-01 still sets the due date normally

Closes #437

When `gog tasks update --due=` was used with an empty value, the due
date was not actually cleared. The help text says "set empty to clear"
but the Google Tasks API PATCH treats an empty string the same as an
omitted field due to `omitempty` JSON tagging.

Add the "Due" field to `NullFields` when the due value is empty, which
forces the API to send an explicit `null` in the PATCH request body,
properly clearing the due date.

Closes openclaw#437
@steipete
Copy link
Copy Markdown
Collaborator

Landed manually on main as part of a grouped Tasks fix commit.

Thanks!

@steipete steipete closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tasks update --due= does not clear the due date

2 participants