Removed changes for cutoff date
This commit is contained in:
parent
396d19b549
commit
bb9dea8ed6
4 changed files with 14 additions and 37 deletions
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
This macro provides a boolean answer to the question:
|
||||
- Is this date before the previous month?
|
||||
- When the current day is before the 20th of the month, it returns:
|
||||
- False for both the current and previous month.
|
||||
- When the current day is the 20th or later, it returns:
|
||||
- False only for the current month.
|
||||
|
||||
Inputs:
|
||||
- date: the date to check
|
||||
Output:
|
||||
- boolean; true if the date is before the previous month
|
||||
false if the date is within the current or previous month
|
||||
(with special handling for the 20th or later of the month)
|
||||
*/
|
||||
{% macro is_date_before_previous_month_fixed_20(date) %}
|
||||
(
|
||||
case
|
||||
-- If today is the 20th or later, only exclude current month
|
||||
when extract(day from now()) >= 20
|
||||
then
|
||||
date_trunc('month', ({{ date }})::date)::date
|
||||
< date_trunc('month', now())::date
|
||||
-- If today is before the 20th, exclude both current and previous month
|
||||
else
|
||||
date_trunc('month', ({{ date }})::date)::date
|
||||
< date_trunc('month', now() - interval '1 month')::date
|
||||
end
|
||||
)
|
||||
{% endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue