Wanted to share since I hadn’t seen this anywhere yet. For the new Date custom field type, when reading a date value via the API you receive
“date_value”: {
“date”: “2022-08-18”,
“date_time”: null
}
For a date. If the value was a datetime, then you would have “date”:null and “date_time” would have an appropriate value.
When updating a custom field in a task, instead of simply specifying the value for the field as “2022-08-18” like you might for a text field, you have to pass an object with either (but not both) a “date” key or a “date_time” key. These dates then follow the same formatting as due_on and due_at.
So to update a date custom field, the call would look something like:
“custom_fields”: {
“4578152156”: {“date”:“2022-08-18”}
},
I didn’t see this in the API docs yet and I didn’t find it when trying to search the forums.
If you use the wrong format, the API returns an error saying your object isn’t formatted correctly or that it was expecting an object, but it took a little trial and error to get it right. Hope this helps someone else.
Excellent post, @Anthony_Tamalonis, thank you! I discovered this a week or two ago and should have posted here but didn’t - but you did the right thing!
I did manage to get it work. The placeholder is a ZD placeholder. which renders the date in this format: 2022-08-18. NFI why my original wouldn’t work.