Skip to content

Dates with times and timezones are now supported on Database Date Filters #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KoditkarVedant opened this issue Oct 25, 2021 · 1 comment
Labels
enhancement New feature or request verification Check if bug/feature needs to be implemented
Milestone

Comments

@KoditkarVedant
Copy link
Contributor

Previously, the date filters equals, after, before, on_or_after, and on_or_before only supported dates without times nor timezones.

{
    "filter": {
        "or": [
            {
                "property": "My Time Property",
                "date": {
                    "before": "2021-10-20"
                }
            }
        ]
    },
    "sorts": []
}

Now the database date filters can accept ISO 8601 dates with timestamps and timezones.

{
    "filter": {
        "or": [
            {
                "property": "My Time Property",
                "date": {
                    "before": "2021-10-15T12:00:00-07:00"
                }
            }
        ]
    },
    "sorts": []
}

How Dates with times are compared

Date time comparisons are done with millisecond precision. If no timezone is provided, the default is UTC.

Equals Date Filter

If a date without a time is provided to the equals, the comparison is done against the start and end of the UTC date provided (inclusive). If a date with a time is provided, the comparison is done with millisecond precision. If no timezone is provided, the default timezone is UTC.

Notion API changelog: https://developers.notion.com/changelog/dates-with-times-and-timezones-are-now-supported-on-database-date-filters

@KoditkarVedant KoditkarVedant added enhancement New feature or request verification Check if bug/feature needs to be implemented labels Oct 25, 2021
@KoditkarVedant KoditkarVedant added this to the 2.2.1 milestone Nov 1, 2021
@KoditkarVedant
Copy link
Contributor Author

We already are using DateTime, hence no changes are required for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request verification Check if bug/feature needs to be implemented
Projects
None yet
Development

No branches or pull requests

1 participant