Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391563
D16630.id.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
D16630.id.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
@@ -362,6 +362,10 @@
$this->cursorHour -= $interval;
$this->rewindHour();
break;
+ case self::FREQUENCY_MINUTELY:
+ $this->cursorMinute -= $interval;
+ $this->rewindMinute();
+ break;
default:
throw new Exception(
pht(
@@ -1236,6 +1240,9 @@
if ($scale < self::SCALE_DAILY) {
$parts[] = $this->stateHour;
}
+ if ($scale < self::SCALE_HOURLY) {
+ $parts[] = $this->stateMinute;
+ }
return implode('/', $parts);
}
@@ -1265,6 +1272,14 @@
}
}
+ private function rewindMinute() {
+ while ($this->cursorMinute < 0) {
+ $this->cursorMinute += 60;
+ $this->cursorHour--;
+ $this->rewindHour();
+ }
+ }
+
private function advanceCursorState(
array $cursor,
$scale,
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
@@ -988,6 +988,58 @@
$expect);
}
+ public function testMinutelyRecurrenceRules() {
+ $tests = array();
+ $expect = array();
+
+ $tests[] = array(
+ );
+ $expect[] = array(
+ '19970902T090000Z',
+ '19970902T090100Z',
+ '19970902T090200Z',
+ );
+
+ $tests[] = array(
+ 'INTERVAL' => 2,
+ );
+ $expect[] = array(
+ '19970902T090000Z',
+ '19970902T090200Z',
+ '19970902T090400Z',
+ );
+
+ $tests[] = array(
+ 'BYHOUR' => array(6, 18),
+ 'BYMINUTE' => array(6, 18),
+ 'BYSECOND' => array(6, 18),
+ );
+ $expect[] = array(
+ '19970902T180606Z',
+ '19970902T180618Z',
+ '19970902T181806Z',
+ );
+
+ $tests[] = array(
+ 'BYSECOND' => array(15, 30, 45),
+ 'BYSETPOS' => array(3, -3),
+ );
+ $expect[] = array(
+ '19970902T090015Z',
+ '19970902T090045Z',
+ '19970902T090115Z',
+ );
+
+ $this->assertRules(
+ array(
+ 'FREQ' => 'MINUTELY',
+ 'COUNT' => 3,
+ 'DTSTART' => '19970902T090000Z',
+ ),
+ $tests,
+ $expect);
+ }
+
private function assertRules(array $defaults, array $tests, array $expect) {
foreach ($tests as $key => $test) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 10:35 AM (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7224409
Default Alt Text
D16630.id.diff (2 KB)
Attached To
Mode
D16630: Support BYSETPOS for RRULE events with FREQ=MINUTELY
Attached
Detach File
Event Timeline
Log In to Comment