Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for relative dates in urls #14893

Merged
merged 1 commit into from Jul 28, 2019

Conversation

@eileenmcnaughton
Copy link
Contributor

commented Jul 27, 2019

Overview

This improves support for relative dates for fields that have been converted to use datepicker

For example

http://dmaster.local/civicrm/contribute/search?reset=1&receive_date_relative=this.year&force=1

Now works to render donations 'This Calendar Year'

Before

No URL support for relative dates

After

URL support for relative dates for fields that already supported high & low - e.g civicrm_activity.activity_date_time, contribution.receive_date - there are still some not converted

Technical Details

I was looking at #13440 & wondering whether the labels map correctly & I figured this was a good way to expose it - by default we have support for
the following prefix (supports n means you can use any number eg. ending_6.year = from 6 years ago until today. You must add a value to civicrm_option_value in the 'relative_date_filters' group to support an 'n' that is not present by default)

prefix meaning e.g supports 'n'
this.x the x of which right now is part This Year proposed - at least partial #13440
previous.x the x immediately before this.x Last Year some
previous_before.x x prior to the previous x The year before Last Year
greater From the start of this x Everything from the start of this year on
greater_previous.x Everything from the end of previous X onwards Everything from the start of last year on
earlier.x all time up until the start of this.x Everything before the start of this year
less.x From start of time to end of current x Everything to the end of this year
current this x until now From the start of this year until now
next the x after this one Next year
ending 1 x up until now Last 12 months ending today Yes
starting from now for 1 x One year from now including today
value label
this.year This calendar year
this.week This week
this.quarter This quarter
this.month This calendar month
this.fiscal_year This fiscal year
this.day Today
starting_2.month Next 60 days including today
starting.year Next 12 months including today
starting.week Next 7 days including today
starting.quarter Next 90 days including today
starting.month Next 30 days including today
starting.day Tomorrow
previous_before.year Year prior to previous calendar year
previous_before.week Week prior to previous week
previous_before.quarter Quarter prior to previous quarter
previous_before.month Month prior to previous calendar month
previous_before.day Day prior to yesterday
previous_2.year Previous 2 calendar years
previous_2.week Previous 2 weeks
previous_2.quarter Previous 2 quarters
previous_2.month Previous 2 calendar months
previous_2.day Previous 2 days
previous.year Previous calendar year
previous.week Previous week
previous.quarter Previous quarter
previous.month Previous calendar month
previous.fiscal_year Previous fiscal year
previous.day Yesterday
next.year Next calendar year
next.week Next week
next.quarter Next quarter
next.month Next calendar month
next.fiscal_year Next fiscal year
less.year To end of current calendar year
less.week To end of current week
less.quarter To end of current quarter
less.month To end of current calendar month
greater_previous.year From end of previous calendar year
greater_previous.week From end of previous week
greater_previous.quarter From end of previous quarter
greater_previous.month From end of previous calendar month
greater.year From start of current calendar year
greater.week From start of current week
greater.quarter From start of current quarter
greater.month From start of current calendar month
greater.day From start of current day
ending_90.day Last 90 days including today
ending_60.day Last 60 days including today
ending_30.day Last 30 days including today
ending_3.year Last 3 years including today
ending_2.year Last 2 years including today
ending.year Last 12 months including today
ending.week Last 7 days including today
earlier.year To end of previous calendar year
earlier.week To end of previous week
earlier.quarter To end of previous quarter
earlier.month To end of previous calendar month
earlier.day To end of yesterday
current.year Current calendar year to-date
current.week Current week to-date
current.quarter Current quarter to-date
current.month Current calendar month to-date

Comments

Fix support for relative dates in urls
This improves support for relative dates for fields that have been converted.

For example

http://dmaster.local/civicrm/contribute/search?reset=1&receive_date_relative=this.year&force=1

Now works to render donations 'This Calendar Year'
@civibot

This comment has been minimized.

Copy link

commented Jul 27, 2019

(Standard links)

@civibot civibot bot added the master label Jul 27, 2019

@seamuslee001

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2019

I tested this with

http://47-test/civicrm/contribute/search?reset=1&receive_date_relative=previous.year&force=1
http://47-test/civicrm/contribute/search?reset=1&receive_date_relative=this.year&force=1

and confirmed it works merging

@seamuslee001 seamuslee001 merged commit 8cd16ad into civicrm:master Jul 28, 2019

1 check passed

default Build finished.
Details

@seamuslee001 seamuslee001 deleted the eileenmcnaughton:date branch Jul 28, 2019

@eileenmcnaughton

This comment has been minimized.

Copy link
Contributor Author

commented Jul 28, 2019

@seamuslee001 yay - I added a link here civicrm/civicrm-dev-docs#624 (although I note the list of what fields support this format is pretty incomplete - I suspect all the recur fields you converted will)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.