• Welcome to XF2 Addons

    You can purchase a Premium membership for only $35 per year, and this gives you access to download any or ALL of the over 400 add-ons developed for Xenforo 2.x. In addition, Premium members will get technical support. Once the Premium membership has expired you can continue to use the installed addons on your forum as long as you like.

How to change or add Calendar holidays?

Andy

Administrator
Staff member
1) In the Options page set the Holiday path.

2) Copy this file to your /misc/ folder.

1512940401315.png


3) Edit the /misc/Holiday.php file as needed.
 
Here is an example for German Holidays. I use it with Calendar 5.5. You can copy the code of the attachment to your Holiday.php.

Some Holidays depends on the easter sunday. This Holidays are calculated by the function easter_date. Therefore there is no need for a special Holiday.php for each calendar year. Code example (not the complete Holiday.php):

Code:
    $tage = 60 * 60 * 24;
       $ostern = easter_date($y);  // Ostersonntag ermitteln
   
       $mkarfreitag = date("n", $ostern - 2 * $tage);
       $dkarfreitag = date("j", $ostern - 2 * $tage); 

    if ($m == $mkarfreitag && $d == $dkarfreitag) // Karfreitag
    return "Karfreitag";

       $mosonntag = date("n", $ostern);
       $dosonntag = date("j", $ostern);

    if ($m == $mosonntag && $d == $dosonntag) // Ostersonntag
    return "Ostersonntag";

The php function easter_date causes a warning for time before 1970 and (on systems with 32 bit) after 2037. Because you can see only the actual year and the year before and after I think there is no need for a special handling of the function limit. And in most cases we have 64 bit servers.
 

Attachments

  • HolidaysD.php
    3.1 KB · Views: 94
Hi Andy,

Please find attached a revised holiday.php for the UK if you wish to share it.

It covers public holidays, fixed and floating, plus seasonal dates such as Halloween, etc for 2022, 2023 and 2024

Regards, Dave
 

Attachments

  • holiday.php
    4.4 KB · Views: 79
Back
Top