Skip to content

Relative date filtering #12901

@sparrowt

Description

@sparrowt

Describe the feature or problem you’d like to solve

When filtering by date it would be helpful to allow relative dates such as -7d for the last 7 days.

Although the docs are not at all clear, it seems you can do ranges but only with absolute dates:

gh search prs --updated ">=2026-01-01"

Proposed solution

It would be great to add support for negative offsets from today e.g. --updated ">=-1d" to find all PRs updated in the last 24h (or today + yesterday inclusive if the date filtering is only done by full day boundaries, I don't mind).

This will be useful for those wishing to automatically show only recently-updated PRs.

Additional context

It would also be helpful if the gh cli docs were more helpful about what date filters are supported.

For example gh search prs --help (and the online equivalent) lists all the following options:

--closed date             Filter on closed at date
--created date            Filter based on created at date
--merged-at date          Filter on merged at date
--updated date            Filter on last updated at date

but does not explain how to use them, either inline or with an example.

From guesswork (based on web github) and just trying stuff it seems that you can do the following:

YYYY-MM-DD
YYYY-MM-DD..YYYY-MM-DD
<YYYY-MM-DD
<=YYYY-MM-DD
>YYYY-MM-DD
>=YYYY-MM-DD

so it would be nice to have this documented, including any other options (if there are any).

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsenhancementa request to improve CLIgh-issuerelating to the gh issue commandgh-prrelating to the gh pr commandgh-searchrelating to the gh search commandstale

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions