stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
8.44k stars 749 forks source link

[Feature] Filter by Date as Relative Number/Last ## Days #5010

Open C-BoT-AU opened 1 week ago

C-BoT-AU commented 1 week ago

Is your feature request related to a problem? Please describe. Currently any filter related to date requires 'absolute' dates - It would be great to include a relative reference to filter by a number of days (or even months).

Describe the solution you'd like Additional option within the filter sub-settings alongside "is", "is not", "is greater than", "is less than" etc. which would essentially allow a relative option of "is greater than". This would/could be applied to all: Created At Date Last Played At Updated At

I don't know if this is possible natively within the query structure (sample below)

operationName : "FindScenes"
query : "..."
    variables : {filter: {q: "", page: 1, per_page: 40, sort: "random_38074273", direction: "DESC"},…}
        filter : {q: "", page: 1, per_page: 40, sort: "random_38074273", direction: "DESC"}
        scene_filter : {date: {modifier: "GREATER_THAN", value: "2024-06-16"}}
            date : {modifier: "GREATER_THAN", value: "2024-06-16"}
                modifier : "GREATER_THAN"
                value : "2024-06-16"

To include something like value : today.setDate(today.getDate() - ##) (I don't speak graphQL sorry), or if you would just need a script off to the side that calculated it (example for 3 days) before then handing it to the query. eg.

let today = new Date();
today.setDate(today.getDate() - 3);
let day = today.getDate();
let month = today.getMonth() + 1;
let year = today.getFullYear();
let value = `${year}-${month}-${day}`;

or

value = datetime.datetime.today() - datetime.timedelta(days=3)

Describe alternatives you've considered / Additional context This can be done manually each time, however by adding it, it would allow for the creation of saved/default views that could be saved to always show the last 30/60/90 days of scenes with any other sort/filter options.