3

CiviCRM 5.24.5, Drupal 7.72

The job "Update Membership Statuses" is set to run once per day. According to the log, it ran on July 1st but no records were updated. I expected to see all memberships that were in status 'Grace' change to 'Expired', instead this didn't happen until July 2nd.

The membership: Fixed, 1 year, starts January 1st fixed rollover day of June 30th.

Grace period: Start Event: end date, no adjustment End event: end date End Event Adjustment: 6 months

Expired: Start Event: end date Start Event Adjustment: 6 months

Thanks for any insight as to what may be causing the 1-day delay.

3

The 'Fixed Period Rollover Date' relates to the start of memberships and is not relevant here.

This is about date maths ...

Grace is defined as End Date (Dec 31) to End Date + 6 months. So what date is "6 months" after Dec 31? If you increment the month and leave the day of month fixed, you get "June 31". That doesn't exist, but if we think of "June 31" as the day after June 30, you get to the last day of Grace being July 1 (not June 30).

So then changing to Expired on July 2 makes sense.

Intuitively we think of Dec 31 as 'end of December', and so 6 months later is 'end of June' - but that's not how it is calculated.

See Example #3

| improve this answer | |
  • hopefully nobody read my unhelpful comment before i deleted it. – petednz - fuzion Jul 3 at 20:41
2

Based on Aidan's helpful explanation you may be able to fix by changing to days. This calculator may help

https://www.timeanddate.com/date/durationresult.html?d1=31&m1=12&y1=2019&d2=30&m2=6&y2=2020&ti=on

which gives 183 as the answer if we set "Include end date in calculation (1 day is added)" though I am not sure if that is correct.

| improve this answer | |
  • 1
    That should work 3 out of 4 years, but leap years will mess things up if you count in days :-( You could override the status rules using hook_civicrm_alterCalculatedMembershipStatus() – Aidan Jul 6 at 9:56
  • 1
    Thanks petednz - fuzio & Aidan, I had thought of the leap year issue as well. Thanks for identifying the hook, that is helpful. Client is going to leave it as-is for now but if it becomes an issue again I will check that out. – freeform.steph Jul 22 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.