[TH] Holidays [Deleted]

I only did 1am because of daylight savings time. Half of the year it would run at 00, the rest at 01.
Nice. Can you enlighten me on how and where to change this?
Is that only a question of changing the "any" to 0 or 1 in the "run at hours" of the Holiday cron like here:
https://www.domain.com/admin.php?cron/th_updateCurrent_holidays/edit

Can't edit it there, is all greyed out.
 
Nice. Can you enlighten me on how and where to change this?
Is that only a question of changing the "any" to 0 or 1 in the "run at hours" of the Holiday cron like here:
https://www.domain.com/admin.php?cron/th_updateCurrent_holidays/edit

Can't edit it there, is all greyed out.
Make a copy of this cron.
Then disable the original cron.
 
Nice. Can you enlighten me on how and where to change this?
Is that only a question of changing the "any" to 0 or 1 in the "run at hours" of the Holiday cron like here:
https://www.domain.com/admin.php?cron/th_updateCurrent_holidays/edit

Can't edit it there, is all greyed out.
Sorry I gave confusing advice. I actually have it set to run at 6:01am GMT time, which is 1:01am my time.

1680974733032.webp
 
Ah, just remembered I already reported this last year in 2022, but it wasn't fix, this was the answer given by a TH worker, who did not code this addon:
It's coded to be enabled all week - to be honest I'm not sure why that is as I didn't build it but that's how it's currently set up.”
which is the reason I had to put it down manually.
So if anybody's wondering, it's a known issue, little mistake on creation but might not get fixed. I totally forgot I asked about it last year myself... memory error on my side. :)

Edit... for whom is interested, I fixed both Eastern and Thanksgiving. Seems Holidays was giving the holidays (when people have free days) so not only the celebration days itself (at least for Easter and Thanksgiving anyway). Hence Easter a week and Thanksgiving 3 days.
I only know a very little php by the way.

In HolidayCalc.php I had a look and for easter under " public static function easter(Holiday $holiday)" I changed the last line with "addweek" to:
$end = (clone($start))->addDays(1)->endOfDay();

There is also this code for Eastern below this one, but I have no clue as to why that is there or why it's needed (as said, know very little php).
Code:
    public static function lent(Holiday $holiday)
    {
        $time = self::getTime();
        $end = (Carbon::createFromTimestamp(easter_date($time->year)))->subDay();
        $start = (clone($end))->subDays(44)->startOfDay();
        $end->subDay()->endOfDay();

        return $time->between($start, $end);
    }

Anyway, a little higher in that file, for Thanksgiving I changed the line with "addDays(3)" to:
$end = (clone($start))->endOfDay();
so now it's only 1 day as Thanksgiving is in fact only 1 day if I'm not mistaken.
 
Last edited:
LOL. Now I have a problem with Easter.
The Easter design won't go away.
Even if I set it to "none" by hand.
The next day Easter is on again.

Auswahl_001.webp

Auswahl_002.webp
 
Yea the holidaycalc does that for several holidays, doing them for a week. (in some cultures, I guess some holidays are celebrated for a week) The dates also vary sometimes for Orthodox cultures (orthodox Christmas is about Jan 7th, Orthdox Easter is April 16, etc) The program often spans all the days from one to the other.
 
Last edited:
The Easter one is based on Orthodox Easter I believe, if you edit the settings for the Easter holiday entry and remove the callback class values, you can set custom dates to enable it.
 
The Easter design won't go away.
Yes I had the same issue. It only went away when I just disabled it with the enable/disable switch for easter itself.

If you want to fix it, it's an easy fix as I showed and it also ended Eastern correctly too.
To precent the file warning from Xenforo, you can remove the hashes.json file or I can give you mine, I created a new one.

Orthdox Easter is April 16, etc)
It started in my case at April 8th instead of 9th, so no orthodox but some other issue probably.
However, how is it with Thanksgiving then? I thought this was a set date just in America, but it was set to 2 days. I created a fix for that one too, it's not that hard to do. This gave me the impression that it was created for free days that people would have (hence easter for a week too).

for the Easter holiday entry and remove the callback class values,
I would like to try that next year if it's again a day early.
Could you post a "look for this and replace by that" kind of manual for this please and which file to edit?
 
No files to edit, you can just edit the holiday settings at ACP > Appearance > Holidays and remove the callback values and set the dates you want:

1681486426787.webp
 
No files to edit, you can just edit the holiday settings at ACP > Appearance > Holidays and remove the callback values and set the dates you want:

View attachment 284602

But so you have to adjust the date every year.

Here is the relevant code:

HolidayCalc.php

Code:
...
public static function easter(Holiday $holiday)
    {
        $time = self::getTime();
        $start = (Carbon::createFromTimestamp(easter_date($time->year)))->startOfDay();
        $end = (clone($start))->addWeek()->endOfDay();

        return $time->between($start, $end);
    }

    /**
     * @param Holiday $holiday
     * @return bool
     */
    public static function lent(Holiday $holiday)
    {
        $time = self::getTime();
        $end = (Carbon::createFromTimestamp(easter_date($time->year)))->subDay();
        $start = (clone($end))->subDays(44)->startOfDay();
        $end->subDay()->endOfDay();

        return $time->between($start, $end);
    }
...
 

No files to edit, you can just edit the holiday settings at ACP > Appearance > Holidays and remove the callback values and set the dates you want:

View attachment 284602
That won't work. I had this as start day april 9th and end date 11 th, but it started at the 8th and did not end at all, so unfortunately that does not work.

HolidayCalc.php
Yes that one.

Find:
$end = (clone($start))->addWeek()->endOfDay();

Replace by:
$end = (clone($start))->addDays(1)->endOfDay();

Same a bit higher for Thanksgiving.
Find:
$end = (clone($start))->addDays(3)->endOfDay();
replace by
$end = (clone($start))->endOfDay();

And it's fixed. Then either remove the hashes.json file or use mine or create a new one yourself to prevent the file check warning in the acp.
 
That won't work. I had this as start day april 9th and end date 11 th, but it started at the 8th and did not end at all, so unfortunately that does not work.
Not really sure what you mean, if you set specific dates then it'll work like any of the other holidays like Christmas and New Year. If the callback is set then it uses that. If it's starting on the 8th then you probably have an issue with the timezone it's using, it sets it to use the board's default timezone.
 
Not really sure what you mean, if you set specific dates then it'll work like any of the other holidays like Christmas and New Year.
I'm not sure whats unclear about that. You gave a screenshot. And it does not work like you say, at least not for eastern.
For Christmas and New Year, yes it does, for Eastern, no it does not, but I don't kow why. As said, I had it setup like that exactly with date 9 <->4 to start and 11<->4 to end, but it started at the 8th and did not end anymore, at least not on the 10th or 11th.

Edit: And no, my timezone is correct, it's set to UTC+1 which is correct. If the timezone would be wrong, all the holidays would be starting on odd days. We do have daylight savings in effect now, but that should only in worst case differ 1 hour, not 1 day.

Can anyone explain what this does? Because I don't know what this still is doing in the HolidayCalc.php because the easter date is already taken from the first line of the part above it.

Code:
    /**
     * @param Holiday $holiday
     * @return bool
     */
    public static function lent(Holiday $holiday)
    {
        $time = self::getTime();
        $end = (Carbon::createFromTimestamp(easter_date($time->year)))->subDay();
        $start = (clone($end))->subDays(44)->startOfDay();
        $end->subDay()->endOfDay();

        return $time->between($start, $end);
    }
 
Can anyone explain what this does? Because I don't know what this still is doing in the HolidayCalc.php because the easter date is already taken from the first line of the part above it.

Code:
    /**
     * @param Holiday $holiday
     * @return bool
     */
    public static function lent(Holiday $holiday)
    {
        $time = self::getTime();
        $end = (Carbon::createFromTimestamp(easter_date($time->year)))->subDay();
        $start = (clone($end))->subDays(44)->startOfDay();
        $end->subDay()->endOfDay();

        return $time->between($start, $end);
    }

I have asked myself the same question.
 
I'm not sure whats unclear about that. You gave a screenshot. And it does not work like you say, at least not for eastern.
For Christmas and New Year, yes it does, for Eastern, no it does not, but I don't kow why. As said, I had it setup like that exactly with date 9 <->4 to start and 11<->4 to end, but it started at the 8th and did not end anymore, at least not on the 10th or 11th.
The point is that if you've set manual dates and removed the callback values, the fact it's Easter is irrelevant, it doesn't know what "Easter" is, it's just two dates. So if you're setting dates, and removing the callback values, and it's activating on a different date, then it sounds like the default board timezone is wrong.
 
If the callback is set then it uses that.
Ah sorry, I was checking your screenshot. So I would have to remove the callback there. Yes indeed, but then I have to set it manually every year. Should not be needed really with php.
I did not had remove the callback in the lines below, so that must have been the reason of not working then.
 
Back
Top Bottom