1
0
mirror of https://github.com/rlanvin/php-rrule.git synced 2025-02-20 09:54:16 +01:00

Omitting repetition ending date

Sometimes it can be useful to omit the repetition ending date if printing a human readable string, so I added this option.
This commit is contained in:
ShoresOfNowhere 2023-01-04 15:20:03 +01:00 committed by GitHub
parent 15646f89da
commit 6758beef76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2092,7 +2092,8 @@ class RRule implements RRuleInterface
'explicit_infinite' => true, 'explicit_infinite' => true,
'include_start' => true, 'include_start' => true,
'include_until' => true, 'include_until' => true,
'custom_path' => null 'custom_path' => null,
'omit_until_date' => false
); );
// attempt to detect default locale // attempt to detect default locale
@ -2369,7 +2370,7 @@ class RRule implements RRuleInterface
$parts['end'] = $i18n['infinite']; $parts['end'] = $i18n['infinite'];
} }
} }
elseif ($this->until) { elseif ($this->until && !$opt['omit_until_date']) {
$parts['end'] = strtr($i18n['until'], array( $parts['end'] = strtr($i18n['until'], array(
'%{date}' => $opt['date_formatter']($this->until) '%{date}' => $opt['date_formatter']($this->until)
)); ));