<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Event Calendar - weekly view</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Event-Calendar---weekly-view-82884</link>
        <description></description>
        <pubDate>Fri, 06 Mar 2026 12:37:22 -0800</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Event-Calendar---weekly-view-82884" rel="self" type="application/rss+xml" />

                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247840#post2247840</link>
          <description><![CDATA[<p>Could you provide a final version of all the files and mods for the calendar. I used the original version many years ago, and think the work you have done would be very useful.</p>]]></description>
          <pubDate>Mon, 13 Jan 2025 09:15:16 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247840#post2247840</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247821#post2247821</link>
          <description><![CDATA[<p>Thank you</p>]]></description>
          <pubDate>Fri, 20 Dec 2024 06:53:51 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247821#post2247821</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247820#post2247820</link>
          <description><![CDATA[<p>Hi MercerDesign,</p>
<p>The issue appears to stem from improper handling of dates that span across two years in the week view, particularly during the transition from week 52/53 of one year to week 1 of the following year. This can lead to inconsistencies in the values generated for $week_start, $start, and $end.</p>
<p>Here is a corrected version for the query in the week view:</p>
<pre class="language-php"><code>// Creates a date for the start of the given week (ISO year and ISO week)
$date = new DateTime();
$date-&gt;setISODate($year, $week); // Sets the date using the ISO year and week

// Format for the start and end of the week
$week_start = $date-&gt;format($FORMAT_START); // First day of the week
$start = $date-&gt;modify('-1 week')-&gt;format($FORMAT_START); // Start of the previous week
$end = $date-&gt;modify('+2 weeks -1 day')-&gt;format($FORMAT_END); // End of the following week

// SQL query to find events overlapping this period
$query = "start_date &lt;= '$end' AND end_date &gt;= '$start'";
</code></pre>
<p>Thanks,<br />Djulia</p>]]></description>
          <pubDate>Fri, 20 Dec 2024 05:30:35 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247820#post2247820</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247819#post2247819</link>
          <description><![CDATA[<p>Hi, I did a CMS upgrade this morning to fix another issue but now any events after the 28th of December are not showing, can you help please? It only seems to be a problem on the week view.</p>]]></description>
          <pubDate>Fri, 20 Dec 2024 04:15:49 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247819#post2247819</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247808#post2247808</link>
          <description><![CDATA[<p>Hi Jeff,</p>
<p>Thanks for the suggestion! Supporting RRule is a great idea for handling complex recurring events like "the 3rd Wednesday of every month for 12 months."</p>
<p>To integrate support for the RRule standard, we can use the PHP Recurr library.</p>
<p>Step 1: Add Recurr to the project via Composer</p>
<pre class="language-php"><code>composer require simshaun/recurr</code></pre>
<p>Step 2: Pre-processing events</p>
<pre class="language-php"><code>use Recurr\Rule;
use Recurr\Transformer\ArrayTransformer;

/**
 * Expands events based on their RRule (recurrence rule).
 *
 * This function processes an array of events, checks if each event has an RRule, 
 * and generates the corresponding occurrences based on the RRule. If an event 
 * does not have an RRule, it is added to the result as is. For events with 
 * valid recurrence rules, the function will expand them into multiple occurrences
 * and return the list of expanded events.
 *
 * @param array $events The array of events, where each event can have an optional 'rrule' key.
 * @return array The array of expanded events with start and end dates adjusted for each occurrence.
 */
function expandRRuleEvents(array $events): array {
    $expandedEvents = [];
    $transformer = new ArrayTransformer();

    foreach ($events as $event) {
        // If the event has no RRule, add it as is
        if (empty($event['rrule'])) {
            $expandedEvents[] = $event;
            continue;
        }

        // Extract original time (hours, minutes, seconds) from the start and end dates
        $originalStartTime = (new DateTime($event['start_date']))-&gt;format('H:i:s');
        $originalEndTime = (new DateTime($event['end_date']))-&gt;format('H:i:s');

        // Ensure the event has a valid recurrence rule
        try {
            $rule = new Rule($event['rrule'], new DateTime($event['start_date']));
            $occurrences = $transformer-&gt;transform($rule);

            foreach ($occurrences as $occurrence) {
                $newEvent = $event;

                // Adjust start and end dates by applying the original time
                $newEvent['start_date'] = $occurrence-&gt;getStart()-&gt;format('Y-m-d') . ' ' . $originalStartTime;
                $newEvent['end_date'] = $occurrence-&gt;getEnd()-&gt;format('Y-m-d') . ' ' . $originalEndTime;

                unset($newEvent['rrule']); // Remove the RRule key to avoid unnecessary duplicates

                $expandedEvents[] = $newEvent;
            }
        } catch (Exception $e) {
            // If the rule is invalid, log the error and skip the event
            error_log("RRule processing error: " . $e-&gt;getMessage());
        }
    }

    return $expandedEvents;
}
</code></pre>
<p>Before calling renderMonthCalendar, we can apply pre-processing to the events.</p>
<pre class="language-php"><code>// Displays the monthly view with events for the month
$expandedEvents = expandRRuleEvents($events);
renderMonthCalendar($month, $year, $expandedEvents, $weekStart, $lang, $translations);</code></pre>
<p>Here’s an example of an event with an RRule:</p>
<pre class="language-php"><code>$events = [
    [
        'title' =&gt; 'Team Meeting',
        'start_date' =&gt; '2024-01-17 10:00:00',
        'end_date' =&gt; '2024-01-17 11:00:00',
        'description' =&gt; 'Monthly team sync-up',
        'location' =&gt; 'Conference Room',
        'rrule' =&gt; 'FREQ=MONTHLY;BYDAY=3WE;COUNT=12',           // RRule for the 3rd Wednesday of each month.
        //'rrule' =&gt; 'FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=12',     // Repeat the event every Monday, Wednesday, and Friday for 12 occurrences.
        //'rrule' =&gt; 'FREQ=YEARLY;BYDAY=1MO;BYMONTH=1;COUNT=5', // Repeat the event on the first Monday of January, every year, for 5 years.
        //'rrule' =&gt; 'FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=10',     // Repeat the event every Monday, Wednesday, and Friday for 10 occurrences.
    ],
];</code></pre>
<p>With this integration, the calendar becomes compatible with complex rules defined by RRule while retaining the flexibility to handle simple or one-time events.</p>
<p>Thanks,<br />Djulia</p>]]></description>
          <pubDate>Wed, 18 Dec 2024 07:03:31 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247808#post2247808</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247804#post2247804</link>
          <description><![CDATA[<p>It would be cool if this could support RRule for repeating events like the 3rd Wednesday of every month for 12 months.</p>]]></description>
          <pubDate>Tue, 17 Dec 2024 09:44:51 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247804#post2247804</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247803#post2247803</link>
          <description><![CDATA[<p>Thank you</p>]]></description>
          <pubDate>Mon, 16 Dec 2024 04:48:19 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247803#post2247803</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247802#post2247802</link>
          <description><![CDATA[<p>Hi MercerDesign,</p>
<p>Can you try with this version? Thanks!</p>
<p>Djulia</p>]]></description>
          <pubDate>Mon, 16 Dec 2024 03:57:40 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247802#post2247802</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247801#post2247801</link>
          <description><![CDATA[<p>Hi, my client needs to show an event that happens at midnight, I tried updating the calendar_functions file but it didn't update anything. Can you help please? I've attached my latest working files.</p>]]></description>
          <pubDate>Mon, 16 Dec 2024 02:53:13 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247801#post2247801</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247761#post2247761</link>
          <description><![CDATA[<p>Thanks! You could perhaps add a <em>vertical-align:top</em> to the cell to align the events. It's just a suggestion.</p>
<pre class="language-css"><code>.calendar-week th, .calendar-week td {
	width: 80px;
	border: 1px solid #ccc;
	padding: 10px;
	text-align: left;
	word-wrap: break-word;
	vertical-align: top;
}</code></pre>]]></description>
          <pubDate>Tue, 26 Nov 2024 00:24:19 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247761#post2247761</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247757#post2247757</link>
          <description><![CDATA[<p>Amazing, thank you</p>]]></description>
          <pubDate>Mon, 25 Nov 2024 08:00:12 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247757#post2247757</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247756#post2247756</link>
          <description><![CDATA[<p>Hi MercerDesign,<br /><br />Can you try with this version? Thanks!<br /><br />Djulia</p>]]></description>
          <pubDate>Mon, 25 Nov 2024 07:57:46 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247756#post2247756</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247755#post2247755</link>
          <description><![CDATA[<p>Hi, hope you are well, I have another request from my client, when an event ends at 9am it also appears in the 9am slot, this looks a bit odd so can it only display in the slot up to 9am for example. I've attached a screenshot and my latest calendar_functions file because I've made changes.</p>]]></description>
          <pubDate>Mon, 25 Nov 2024 06:06:38 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247755#post2247755</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247753#post2247753</link>
          <description><![CDATA[<p>Thank you, that's worked</p>]]></description>
          <pubDate>Thu, 21 Nov 2024 01:15:10 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247753#post2247753</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247752#post2247752</link>
          <description><![CDATA[<p>Hi MercerDesign,</p>
<p>You can use user-agent analysis in the getCalendarParams() function :</p>
<pre class="language-php"><code>/**
 * Retrieves and validates calendar parameters from the GET request.
 * Defaults to the current month, year, week, and day if parameters are not set.
 */
function getCalendarParams() {
    // Define default parameters
    $defaults = [
        'view'  =&gt; 'month',
        'year'  =&gt; date('Y'),
        'month' =&gt; date('m'),
        'week'  =&gt; date('W'),
        'day'   =&gt; date('d')
    ];

    // Retrieve GET parameter values, using default values if not set
    $view  = isset($_GET['view']) ? $_GET['view'] : null;
    $year  = isset($_GET['year']) ? intval($_GET['year']) : $defaults['year'];
    $month = isset($_GET['month']) ? intval($_GET['month']) : $defaults['month'];
    $week  = isset($_GET['week']) ? intval($_GET['week']) : $defaults['week'];
    $day   = isset($_GET['day']) ? intval($_GET['day']) : $defaults['day'];

    // List of allowed views
    $allowed_views = ['month', 'week', 'day', 'year'];

    // Device detection
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    if (is_null($view)) { // Only if the view is not specified in $_GET
        if (preg_match('/Mobile|Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i', $user_agent)) {
            $view = 'day'; // Default view for mobile
        } else {
            $view = 'week'; // Default view for desktop
        }
    }

    // Validate parameters
    $view = in_array($view, $allowed_views) ? $view : $defaults['view'];
    $year = ($year &gt;= 1970 &amp;&amp; $year &lt;= date('Y') + 25) ? $year : $defaults['year'];
    $month = ($month &gt;= 1 &amp;&amp; $month &lt;= 12) ? $month : $defaults['month'];
    $week = ($week &gt;= 1 &amp;&amp; $week &lt;= 53) ? $week : $defaults['week'];
    $day = ($day &gt;= 1 &amp;&amp; $day &lt;= 31) ? $day : $defaults['day'];

    // Return validated parameters as an array
    return [
        'view'  =&gt; $view,
        'year'  =&gt; $year,
        'month' =&gt; $month,
        'week'  =&gt; $week,
        'day'   =&gt; $day
    ];
}</code></pre>
<p>However, if you're looking for a more accurate solution, the Mobile Detect library is commonly used to determine whether the user is accessing the site from a mobile device or a desktop.<br /><a href="https://github.com/serbanghita/Mobile-Detect" rel="nofollow">https://github.com/serbanghita/Mobile-Detect</a></p>
<p>Thanks,<br />Djulia</p>]]></description>
          <pubDate>Wed, 20 Nov 2024 08:00:08 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247752#post2247752</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247751#post2247751</link>
          <description><![CDATA[<p>One final request, do you know how I can tell the calendar to open in the Day view when on a mobile instead of the Week view?</p>]]></description>
          <pubDate>Wed, 20 Nov 2024 07:19:08 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247751#post2247751</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247748#post2247748</link>
          <description><![CDATA[<p>Your a star! Thank you</p>]]></description>
          <pubDate>Thu, 14 Nov 2024 00:11:49 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247748#post2247748</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247745#post2247745</link>
          <description><![CDATA[<p>Sorry for the delay, I had to finish a task. Could you please try this version? Thanks!</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 10:05:47 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247745#post2247745</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247744#post2247744</link>
          <description><![CDATA[<p>Have updated.</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 04:17:55 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247744#post2247744</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247743#post2247743</link>
          <description><![CDATA[<p>Thank you, I can reproduce the issue. In the meantime, could you use this file? Thanks!</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 04:13:37 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247743#post2247743</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247742#post2247742</link>
          <description><![CDATA[<p>I've updated with showme()</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 04:02:59 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247742#post2247742</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247741#post2247741</link>
          <description><![CDATA[<p>Can you provide the event in this format or with showme()? Thanks!<br /><br /></p>
<pre class="language-php"><code>[
  'title' =&gt; 'Annual Conference',
  'start_date' =&gt; '2024-11-13 13:00:00',
  'end_date' =&gt; '2024-11-13 13:10:00',
  'permalink' =&gt; 'annual-conference',
  'description' =&gt; 'Annual conference on technological innovations.',
  'location' =&gt; 'Main Auditorium',
  'category' =&gt; 'conference'
],</code></pre>]]></description>
          <pubDate>Wed, 13 Nov 2024 03:56:17 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247741#post2247741</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247740#post2247740</link>
          <description><![CDATA[<p>The error is because I'm not using the permalink but I don't want to keep having to edit the file at this stage, the event still disappears when I change the time</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 03:48:02 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247740#post2247740</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247739#post2247739</link>
          <description><![CDATA[<p>What do the errors say in the Developer Log?</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 03:44:07 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247739#post2247739</guid>
        </item>
                <item>
          <title>Event Calendar - weekly view</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247738#post2247738</link>
          <description><![CDATA[<p>I've done that.</p>]]></description>
          <pubDate>Wed, 13 Nov 2024 03:33:51 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247738#post2247738</guid>
        </item>
              </channel>
    </rss>
  