I’m having trouble with date formats in the Notion API. I keep getting this error:
{
"object": "error",
"status": 400,
"code": "validation_error",
"message": "DateField has an invalid date value."
}
I’ve tried various formats like:
2023/08/21
2023/21/08
2023/8/21
2023/08/21 12:00:00
But nothing seems to work. It’s frustrating that the correct format isn’t clearly stated in the docs. Does anyone know the right way to input dates for Notion’s API? I’d really appreciate some help figuring this out!
hey hermione_book, i’ve been there! notion’s api can be finicky wth dates.
try using the iso 8601 format like ‘2023-08-21T00:00:00Z’ or just ‘2023-08-21’ for date-only. that usually does the trick for me. let me know if it works!
I feel your pain with the Notion API date formatting! It can definitely be tricky. From my experience, the key is using ISO 8601 format. Try ‘2023-08-21T00:00:00Z’ for full datetime or just ‘2023-08-21’ for date-only.
I ran into similar issues and found that Notion’s API is quite particular about dates. Make sure you’re using hyphens (-) instead of slashes (/) and include the ‘T’ and ‘Z’ for timezone if you’re specifying a time.
If you’re still having trouble, double-check that your date string is properly escaped in your JSON payload. Sometimes that can cause unexpected errors.
Hope this helps!
As someone who’s worked extensively with the Notion API, I can confirm that ISO 8601 is indeed the way to go. The format ‘2023-08-21T00:00:00Z’ for full datetime or ‘2023-08-21’ for date-only should resolve your issues.
One thing to watch out for is timezone handling. If you’re not specifying a time, Notion will default to midnight in your workspace’s timezone. This can sometimes lead to unexpected behavior if you’re not careful.
Also, when working with date ranges, make sure both start and end dates are in the correct format. I’ve seen cases where one date was formatted correctly, but the other wasn’t, causing silent failures.
If you’re still having trouble, double-check your API call structure. Sometimes the issue isn’t the date format itself, but how it’s being passed in the request body.