Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion libraries/php-rrule/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## [Unreleased]

## [3.0.0] - 2026-07-29

- Drop support for PHP < 7.3 [#119](https://github.com/rlanvin/php-rrule/issues/119)
- Add support for PHP 8.4

### Fixed

- Added a workaround for a Carbon 3 bug that makes occursAt fail in some cases [#164](https://github.com/rlanvin/php-rrule/issues/164)
- Fix RSet not de-duplicating when using array access [#165](https://github.com/rlanvin/php-rrule/issues/165)
- Fix timezone conversion skipped with DateTimeImmutable [#171](https://github.com/rlanvin/php-rrule/pull/171)

## [2.6.0] - 2025-04-25

### Added
Expand Down Expand Up @@ -289,7 +300,8 @@

- First release, everything before that was unversioned (`dev-master` was used).

[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v2.6.0...HEAD
[Unreleased]: https://github.com/rlanvin/php-rrule/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/rlanvin/php-rrule/compare/v2.6.0...v3.0.0
[2.6.0]: https://github.com/rlanvin/php-rrule/compare/v2.5.2...v2.6.0
[2.5.2]: https://github.com/rlanvin/php-rrule/compare/v2.5.1...v2.5.2
[2.5.1]: https://github.com/rlanvin/php-rrule/compare/v2.5.0...v2.5.1
Expand Down
2 changes: 1 addition & 1 deletion libraries/php-rrule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Complete documentation and more examples are available in [the wiki](https://git

## Requirements

- PHP >= 5.6
- PHP >= 7.3
- [intl extension](http://php.net/manual/en/book.intl.php) is recommended for `humanReadable()` but not strictly required

## Installation
Expand Down
Empty file modified libraries/php-rrule/bin/import_windows_timezones.php
100755 → 100644
Empty file.
42 changes: 33 additions & 9 deletions libraries/php-rrule/src/RRule.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ function is_leap_year($year)
return true;
}

/**
* Carbon 3 specific workaround - shouldn't be necessary but here we are.
* Original bug: https://github.com/briannesbitt/Carbon/issues/3018
* Workaround could be removed if the bug is fixed
*
* @see https://github.com/rlanvin/php-rrule/issues/164
* @return int
*/
function date_interval_days(\DateInterval $interval): int
{
if ($interval->days !== false) {
return $interval->days;
}

// if days is false, we might be dealing with Carbon.
// we try to get it from format() instead, and cast it to int
$days = $interval->format('%a');
if ($days !== '(unknown)' && is_numeric($days)) {
return (int) $days;
}

throw new \RuntimeException("Unable to get days from DateInterval. This shouldn't happen. If you are using a custom date library, trying passing a normal \DateTime.");
}

/**
* Implementation of RRULE as defined by RFC 5545 (iCalendar).
* Heavily based on python-dateutil/rrule
Expand Down Expand Up @@ -582,7 +606,7 @@ public function rfcString($include_timezone = true)
// handle unsupported timezones like "+02:00"
// we convert them to UTC to generate a valid string
// note: there is possibly other weird timezones out there that we should catch
$dtstart->setTimezone(new \DateTimeZone('UTC'));
$dtstart = $dtstart->setTimezone(new \DateTimeZone('UTC'));
$timezone_name = 'UTC';
}
if (in_array($timezone_name, array('UTC','GMT','Z'))) {
Expand Down Expand Up @@ -616,13 +640,13 @@ public function rfcString($include_timezone = true)
if (! $include_timezone) {
$tmp = clone $this->until;
// put until on the same timezone as DTSTART
$tmp->setTimeZone($this->dtstart->getTimezone());
$tmp = $tmp->setTimeZone($this->dtstart->getTimezone());
$parts[] = 'UNTIL='.$tmp->format('Ymd\THis');
}
else {
// according to the RFC, UNTIL must be in UTC
$tmp = clone $this->until;
$tmp->setTimezone(new \DateTimeZone('UTC'));
$tmp = $tmp->setTimezone(new \DateTimeZone('UTC'));
$parts[] = 'UNTIL='.$tmp->format('Ymd\THis\Z');
}
continue;
Expand Down Expand Up @@ -746,7 +770,7 @@ public function occursAt($date)
{
$date = self::parseDate($date);
// convert timezone to dtstart timezone for comparison
$date->setTimezone($this->dtstart->getTimezone());
$date = $date->setTimezone($this->dtstart->getTimezone());

if (in_array($date, $this->cache)) {
// in the cache (whether cache is complete or not)
Expand Down Expand Up @@ -847,37 +871,37 @@ public function occursAt($date)
// count nb of days and divide by 7 to get number of weeks
// we add some days to align dtstart with wkst
$diff = $date->diff($this->dtstart);
$diff = (int) (($diff->days + pymod($this->dtstart->format('N') - $this->wkst,7)) / 7);
$diff = (int) ((date_interval_days($diff) + pymod($this->dtstart->format('N') - $this->wkst,7)) / 7);
if ($diff % $this->interval !== 0) {
return false;
}
break;
case self::DAILY:
// count nb of days
$diff = $date->diff($this->dtstart);
if ($diff->days % $this->interval !== 0) {
if (date_interval_days($diff) % $this->interval !== 0) {
return false;
}
break;
// XXX: I'm not sure the 3 formulas below take the DST into account...
case self::HOURLY:
$diff = $date->diff($this->dtstart);
$diff = $diff->h + $diff->days * 24;
$diff = $diff->h + date_interval_days($diff) * 24;
if ($diff % $this->interval !== 0) {
return false;
}
break;
case self::MINUTELY:
$diff = $date->diff($this->dtstart);
$diff = $diff->i + $diff->h * 60 + $diff->days * 1440;
$diff = $diff->i + $diff->h * 60 + date_interval_days($diff) * 1440;
if ($diff % $this->interval !== 0) {
return false;
}
break;
case self::SECONDLY:
$diff = $date->diff($this->dtstart);
// XXX does not account for leap second (should it?)
$diff = $diff->s + $diff->i * 60 + $diff->h * 3600 + $diff->days * 86400;
$diff = $diff->s + $diff->i * 60 + $diff->h * 3600 + date_interval_days($diff) * 86400;
if ($diff % $this->interval !== 0) {
return false;
}
Expand Down
Empty file modified libraries/php-rrule/src/RRuleInterface.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/RRuleTrait.php
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion libraries/php-rrule/src/RSet.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,15 @@ public function count()
#[\ReturnTypeWillChange]
public function getIterator()
{
$previous_occurrence = null;
$total = 0;

$occurrence = null;
foreach ($this->cache as $occurrence) {
yield clone $occurrence; // since DateTime is not immutable, avoid any problem

$total += 1;
}
$previous_occurrence = $occurrence;

if ($this->rlist_heap === null) {
// rrules + rdate
Expand Down
Empty file modified libraries/php-rrule/src/RfcParser.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/de.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/en.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/fi.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/fr.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/nl.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/ru.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/i18n/sv.php
100755 → 100644
Empty file.
Empty file modified libraries/php-rrule/src/tzdata/windows.php
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions repeating_dates.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ type = module
backdrop = 1.x
package = Fields
tags[] = Fields
php = 7.3

dependencies[] = field
Loading