Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19623315
D16607.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16607.diff
View Options
diff --git a/src/parser/calendar/data/PhutilCalendarRecurrenceRule.php b/src/parser/calendar/data/PhutilCalendarRecurrenceRule.php
--- a/src/parser/calendar/data/PhutilCalendarRecurrenceRule.php
+++ b/src/parser/calendar/data/PhutilCalendarRecurrenceRule.php
@@ -681,7 +681,7 @@
$by_weekno,
$week_start) {
- $year_map = $this->getYearMap($this->cursorYear, $week_start);
+ $year_map = $this->getYearMap($this->stateYear, $week_start);
$selection = array();
if ($interval_week) {
@@ -813,7 +813,7 @@
// year starts on and avoid the cost of a DateTime construction, but I
// wasn't able to turn it up and we only need to do this once per year.
$datetime = new DateTime("{$year}-01-01", new DateTimeZone('UTC'));
- $weekday = $datetime->format('w');
+ $weekday = (int)$datetime->format('w');
if ($is_leap) {
$max_day = 366;
@@ -870,6 +870,7 @@
$key = "{$month_number}M{$month_day}D";
$info = array(
+ 'year' => $year,
'key' => $key,
'month' => $month_number,
'monthday' => $month_day,
diff --git a/src/parser/calendar/data/__tests__/PhutilCalendarRecurrenceRuleTestCase.php b/src/parser/calendar/data/__tests__/PhutilCalendarRecurrenceRuleTestCase.php
--- a/src/parser/calendar/data/__tests__/PhutilCalendarRecurrenceRuleTestCase.php
+++ b/src/parser/calendar/data/__tests__/PhutilCalendarRecurrenceRuleTestCase.php
@@ -149,6 +149,25 @@
'19971003',
);
+ $tests[] = array(
+ 'BYMONTH' => array(1, 3),
+ 'BYMONTHDAY' => array(5, 7),
+ );
+ $expect[] = array(
+ '19980105',
+ '19980107',
+ '19980305',
+ );
+
+ $tests[] = array(
+ 'BYDAY' => array('TU', 'TH'),
+ );
+ $expect[] = array(
+ '19970902',
+ '19970904',
+ '19970909',
+ );
+
$this->assertRules(
array(
'FREQ' => 'YEARLY',
@@ -175,6 +194,11 @@
$rrule->setInterval($interval);
}
+ $by_day = idx($options, 'BYDAY');
+ if ($by_day) {
+ $rrule->setByDay($by_day);
+ }
+
$by_month = idx($options, 'BYMONTH');
if ($by_month) {
$rrule->setByMonth($by_month);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Feb 5 2026, 3:40 PM (10 w, 7 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8536631
Default Alt Text
D16607.diff (2 KB)
Attached To
Mode
D16607: Fix a remaining `cursorYear` instead of `stateYear`
Attached
Detach File
Event Timeline
Log In to Comment