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

Handle conditional dates for liturgical events in national calendars #206

Open
JohnRDOrazio opened this issue Apr 25, 2024 · 1 comment
Open
Milestone

Comments

@JohnRDOrazio
Copy link
Member

Certain events loaded from national liturgical calendars require some logic to create the event conditionally based on whether it falls on a Sunday or Solemnity. This logic is currently hardcoded into the main LitCalAPI class. An example is the National Day of Prayer for the Unborn in the USA:

if( self::DateIsSunday( $currentFeastDate ) && $row->TAG === "PrayerUnborn" ) {
$festivity = new Festivity( "[ USA ] " . $row->NAME, $currentFeastDate->add( new DateInterval( 'P1D' ) ), $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON, $row->DISPLAYGRADE );
$this->Cal->addFestivity( $row->TAG, $festivity );
$this->Messages[] = sprintf(
"USA: The National Day of Prayer for the Unborn is set to Jan 22 as per the 2011 Roman Missal issued by the USCCB, however since it coincides with a Sunday or a Solemnity in the year %d, it has been moved to Jan 23",
$this->LitSettings->Year
);
} else {

We should extend the national calendar schemas to allow for language constructs that will allow to define rules for how such situations should be handled. This will likely require a bit of thought and planning, based on various concrete examples.

@JohnRDOrazio JohnRDOrazio added this to the v4.0 milestone Apr 25, 2024
@JohnRDOrazio
Copy link
Member Author

JohnRDOrazio commented Apr 25, 2024

something like this:

"rules": [
    {
        "condition": {
            "coincidesWith": {
                "LitGrade": "SOLEMNITY"
            }
        },
        "then": {
            "move": "P1D"
        }
    }
]

The "coincidesWith" object could possibly accept a few different properties other than "LitGrade", for example it could be the eventkey of a specific liturgical event...

The "then" instruction could possibly accept a few different properties... whether a period of time to move it such as adding one day, or moving it one day before or after a specific other liturgical event (therefore specifying the eventkey of the other liturgical event)...

There will probably ever be only one rule, however this construct would allow for having more than rule. Rules would have to be applied in sequence...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant