Problem/Motivation

My club needs a membership expiring on the 1st of November of every year, regardless of when you join.
According to the documentation, and looking at older issues (like #3036203), I should be able to use a strtotime relative date, like "first day of november", but instead I get the error "Role expiry default duration must be a relative strtotime-compatible string.".

Steps to reproduce

  1. Create or edit a role
  2. Set "first day of november" in the Default duration for the role field
  3. Save

Proposed resolution

Removing lines 92-95 from role_expire.module seems working as it should, setting the role expiration date to "Tue, 11/01/2022 - 00:00", which is the next occurrence of the 1st of November for this year, and it should work as well for the future years.
I expect the new expiration date will be set for the next occurrence (eg 1st Nov 2023), when I re-assign the role to the users who renewed their membership.

I wonder thought why this change has been introduced in the first place: the form currently accepts "first day of the next month", I'm unsure why it shouldn't accept the above syntax. The blame commit points to issue #2998705, but there's no real explanation given.

Remaining tasks

  1. Verify why this has been set like that.
  2. If not completely intentional, adjust the validation check or remove it

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#4 strtotime-check-3275802-4.patch705 byteselgandoz

Comments

elgandoz created an issue. See original summary.

elgandoz’s picture

Issue summary: View changes
elgandoz’s picture

Issue summary: View changes
elgandoz’s picture

StatusFileSize
new705 bytes

Proposed temporary patch (removing check for absolute) attached