How to customize the grouping method

When I use dopus, I open the picture folder and hope to group according to the modification time, but this grouping method can only be grouped according to the fixed today, yesterday, last week, etc. I want to define the grouping method according to the year, quarter, month, day, hour and other methods. What should I do?

Grab this script and modify it to your needs:

This script is great, thank you very much! I sincerely hope that you have the time to develop an interactive version of the graphical conversation for custom grouping so that regular users like me can customize the grouping with buttons and edit boxes