Extend functionality of $__timeEpoch and $__timeFilter


I am trying to see if one can extend the functionality of $__timeEpoc() and $__timeFilter() macros to add the ability of time shifts, so that it is possible to use time range picker and dynamically display historical data from the specified date range from say a year or a month ago.

In the case of the $__timeFilter(column) that in MSSQL translates as column BETWEEN @startDate AND @endDate which are taken from date time picker specified period, it would be great if one can specify extra parameter such as $__timeFilter(column, month, -1) where it would generate time period shifted by -1 month.

Can someone point out where in the codebase these macros live?

Thanks a lot!