Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_repeat/tests/date_repeat.test
4 4
 * @file
5 5
 * Test Date Repeat calculations.
6 6
 */
7

  
7
/**
8
 *
9
 */
8 10
class DateRepeatTestCase extends DrupalWebTestCase {
9 11
  public static function getInfo() {
10 12
    return array(
......
17 19
  /**
18 20
   * Implements setUp().
19 21
   */
20
  public function setUp() {
22
  public function setUp(array $modules = array()) {
21 23
    // Load the date_repeat module.
22
    parent::setUp('date_api', 'date_repeat');
24
    $modules[] = 'date_api';
25
    $modules[] = 'date_repeat';
26
    parent::setUp($modules);
23 27
  }
24 28

  
25 29
  public function testDateRepeat() {
26
    require_once('./' . drupal_get_path('module', 'date_api') . '/date_api_ical.inc');
27
    require_once('./' . drupal_get_path('module', 'date_repeat') . '/date_repeat_calc.inc');
30
    require_once './' . drupal_get_path('module', 'date_api') . '/date_api_ical.inc';
31
    require_once './' . drupal_get_path('module', 'date_repeat') . '/date_repeat_calc.inc';
32

  
28 33
    // Examples adapted from http://www.faqs.org/rfcs/rfc2445.html and
29 34
    // http://www.kanzaki.com/docs/ical/rrule.html.
30

  
31 35
    //  Invalid value:
32 36
    $start = "1997-09-02 09:00:00";
33 37
    $end = "1997-09-30 09:00:00";
......
48 52
    $result = implode(', ', $dates);
49 53
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
50 54

  
51
    //Daily until September 24, 1997:
55
    // Daily until September 24, 1997:
52 56
    $start = "1997-09-02 09:00:00";
53 57
    $end = "1997-09-30 09:00:00";
54 58
    $rule = "RRULE:FREQ=DAILY;UNTIL=19970924T000000Z";
......
58 62
    $result = implode(', ', $dates);
59 63
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
60 64

  
61
    //Every other day - until September 30:
65
    // Every other day - until September 30:
62 66
    $start = "1997-09-02 09:00:00";
63 67
    $end = "1997-09-30 09:00:00";
64 68
    $rule = "RRULE:FREQ=DAILY;INTERVAL=2";
......
68 72
    $result = implode(', ', $dates);
69 73
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
70 74

  
71
    //Every 10 days, 2 occurrences:
75
    // Every 10 days, 2 occurrences:
72 76
    $start = "1997-09-02 09:00:00";
73 77
    $end = "1997-09-30 09:00:00";
74 78
    $rule = "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=2";
......
78 82
    $result = implode(', ', $dates);
79 83
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
80 84

  
81
    //Weekly for 3 occurrences
85
    // Weekly for 3 occurrences.
82 86
    $start = "1997-09-02 09:00:00";
83 87
    $end = "1997-09-30 09:00:00";
84 88
    $rule = "RRULE:FREQ=WEEKLY;COUNT=3";
......
88 92
    $result = implode(', ', $dates);
89 93
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
90 94

  
91
    //Weekly until September 24, 1997
95
    // Weekly until September 24, 1997
92 96
    $start = "1997-09-02 09:00:00";
93 97
    $end = "1997-09-30 09:00:00";
94 98
    $rule = "RRULE:FREQ=WEEKLY;UNTIL=19970924T000000Z";
......
98 102
    $result = implode(', ', $dates);
99 103
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
100 104

  
101
    //Every other week - forever:
105
    // Every other week - forever:
102 106
    $start = "1997-09-02 09:00:00";
103 107
    $end = "1997-09-30 09:00:00";
104 108
    $rule = "RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU";
......
108 112
    $result = implode(', ', $dates);
109 113
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
110 114

  
111
    //Weekly on Tuesday and Thursday for 4 weeks:
115
    // Weekly on Tuesday and Thursday for 4 weeks:
112 116
    $start = "1997-09-02 09:00:00";
113 117
    $end = "1997-09-30 09:00:00";
114 118
    $rule = "RRULE:FREQ=WEEKLY;COUNT=8;WKST=SU;BYDAY=TU,TH";
......
118 122
    $result = implode(', ', $dates);
119 123
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
120 124

  
121
    //Every other week on Tuesday and Thursday, for 5 occurrences:
125
    // Every other week on Tuesday and Thursday, for 5 occurrences:
122 126
    $start = "1997-09-02 09:00:00";
123 127
    $end = "1997-09-30 09:00:00";
124 128
    $rule = "RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=5;WKST=SU;BYDAY=TU,TH";
......
128 132
    $result = implode(', ', $dates);
129 133
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
130 134

  
131
    //Every other week on Monday, Wednesday and Friday until September 24, 1997,
135
    // Every other week on Monday, Wednesday and Friday until September 24, 1997,
132 136
    $start = "1997-09-02 09:00:00";
133 137
    $end = "1997-09-30 09:00:00";
134 138
    $rule = "RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=19970924T000000Z;WKST=SU;BYDAY=MO,WE,FR";
......
138 142
    $result = implode(', ', $dates);
139 143
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
140 144

  
141
    //Monthly on the 1st Friday for 2 occurrences:
145
    // Monthly on the 1st Friday for 2 occurrences:
142 146
    $start = "1997-09-05 09:00:00";
143 147
    $end = "1997-10-31 09:00:00";
144 148
    $rule = "RRULE:FREQ=MONTHLY;COUNT=2;BYDAY=1FR";
......
148 152
    $result = implode(', ', $dates);
149 153
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
150 154

  
151
    //Monthly on the 1st Friday until December 24, 1997:
155
    // Monthly on the 1st Friday until December 24, 1997:
152 156
    $start = "1997-09-05 09:00:00";
153 157
    $end = "1998-10-01 09:00:00";
154 158
    $rule = "RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR";
......
157 161
    $result = implode(', ', $dates);
158 162
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
159 163

  
160
    //Every other month on the 1st and last Sunday of the month for 10 occurrences:
164
    // Every other month on the 1st and last Sunday of the month for 10 occurrences:
161 165
    $start = "1997-09-07 09:00:00";
162 166
    $end = "1998-10-01 09:00:00";
163 167
    $rule = "RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU";
......
170 174
    $result = implode(', ', $dates);
171 175
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
172 176

  
173
    //Monthly on the second to last Monday of the month for 6 months:
177
    // Monthly on the second to last Monday of the month for 6 months:
174 178
    $start = "1997-09-22 09:00:00";
175 179
    $end = "1998-10-01 09:00:00";
176 180
    $rule = "RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO";
177
    //==> (1997 9:00 AM EDT)September 22;October 20
181
    // ==> (1997 9:00 AM EDT)September 22;October 20
178 182
    //  (1997 9:00 AM EST)November 17;December 22
179 183
    //  (1998 9:00 AM EST)January 19;February 16
180 184
    $dates = date_repeat_calc($rule, $start, $end, array());
......
182 186
    $result = implode(', ', $dates);
183 187
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
184 188

  
185
    //Every Tuesday, every other month:
189
    // Every Tuesday, every other month:
186 190
    $start = "1997-09-02 09:00:00";
187 191
    $end = "1998-02-01 09:00:00";
188 192
    $rule = "RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU";
......
194 198
    $result = implode(', ', $dates);
195 199
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
196 200

  
197
    //Yearly in June and July for 10 occurrences:
201
    // Yearly in June and July for 10 occurrences:
198 202
    $start = "1997-06-10 09:00:00";
199 203
    $end = "2002-01-01 09:00:00";
200 204
    $rule = "RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7";
......
204 208
    //      (2000 9:00 AM EDT)June 10;July 10
205 209
    //      (2001 9:00 AM EDT)June 10;July 10
206 210
    //  Note: Since none of the BYDAY, BYMONTHDAY or BYYEARDAY components
207
    //  are specified, the day is gotten from DTSTART
211
    //  are specified, the day is gotten from DTSTART.
208 212
    $dates = date_repeat_calc($rule, $start, $end, array());
209 213
    $shouldbe = '1997-06-10 09:00:00, 1997-07-10 09:00:00, 1998-06-10 09:00:00, 1998-07-10 09:00:00, 1999-06-10 09:00:00, 1999-07-10 09:00:00, 2000-06-10 09:00:00, 2000-07-10 09:00:00, 2001-06-10 09:00:00, 2001-07-10 09:00:00';
210 214
    $result = implode(', ', $dates);
211 215
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
212 216

  
213
    //Every other year on January, February, and March for 10 occurrences:
217
    // Every other year on January, February, and March for 10 occurrences:
214 218
    $start = "1997-03-10 09:00:00";
215 219
    $end = "2004-01-01 09:00:00";
216 220
    $rule = "RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3";
......
223 227
    $result = implode(', ', $dates);
224 228
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
225 229

  
226
    //An example where the days generated makes a difference because of WKST:
230
    // An example where the days generated makes a difference because of WKST:
227 231
    $start = "1997-08-05 09:00:00";
228 232
    $end = "2004-01-01 09:00:00";
229 233
    $rule = "RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO";
......
233 237
    $result = implode(', ', $dates);
234 238
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
235 239

  
236
    //changing only WKST from MO to SU, yields different results...
240
    // changing only WKST from MO to SU, yields different results...
237 241
    $start = "1997-08-05 09:00:00";
238 242
    $end = "2004-01-01 09:00:00";
239 243
    $rule = "RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=SU";
......
243 247
    $result = implode(', ', $dates);
244 248
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
245 249

  
246
    //Every 18 months on the 10th thru 15th of the month for 10 occurrences:
250
    // Every 18 months on the 10th thru 15th of the month for 10 occurrences:
247 251
    $start = "1997-09-10 09:00:00";
248 252
    $end = "2004-01-01 09:00:00";
249 253
    $rule = "RRULE:FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,15";
......
254 258
    $result = implode(', ', $dates);
255 259
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
256 260

  
257
    //Monthly on the third to the last day of the month, forever:
261
    // Monthly on the third to the last day of the month, forever:
258 262
    $start = "1997-09-28 09:00:00";
259 263
    $end = "1998-03-01 09:00:00";
260 264
    $rule = "RRULE:FREQ=MONTHLY;BYMONTHDAY=-3";
......
266 270
    $result = implode(', ', $dates);
267 271
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
268 272

  
269
    //Every Thursday in March, forever:
273
    // Every Thursday in March, forever:
270 274
    //  ==> (1997 9:00 AM EST)March 13,20,27
271 275
    //      (1998 9:00 AM EST)March 5,12,19,26
272 276
    //      (1999 9:00 AM EST)March 4,11,18,25
......
278 282
    $result = implode(', ', $dates);
279 283
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
280 284

  
281
    //Every Thursday, but only during June, July, and August, forever:
285
    // Every Thursday, but only during June, July, and August, forever:
282 286
    //  ==> (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;August 7,14,21,28
283 287
    //      (1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;August 6,13,20,27
284 288
    //      (1999 9:00 AM EDT)June 3,10,17,24;July 1,8,15,22,29;August 5,12,19,26
......
290 294
    $result = implode(', ', $dates);
291 295
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
292 296

  
293
    //Monthly on the 2nd and 15th of the month for 10 occurrences:
297
    // Monthly on the 2nd and 15th of the month for 10 occurrences:
294 298
    //  ==> (1997 9:00 AM EDT)September 2,15;October 2,15
295 299
    //      (1997 9:00 AM EST)November 2,15;December 2,15
296 300
    //      (1998 9:00 AM EST)January 2,15
......
302 306
    $result = implode(', ', $dates);
303 307
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
304 308

  
305
    //Monthly on the first and last day of the month for 10 occurrences:
309
    // Monthly on the first and last day of the month for 10 occurrences:
306 310
    //  ==> (1997 9:00 AM EDT)September 30;October 1
307 311
    //      (1997 9:00 AM EST)October 31;November 1,30;December 1,31
308 312
    //      (1998 9:00 AM EST)January 1,31;February 1
......
314 318
    $result = implode(', ', $dates);
315 319
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
316 320

  
317
    //Every Friday the 13th, forever:
321
    // Every Friday the 13th, forever:
318 322
    $rule = "EXDATE;TZID=US-Eastern:19970902T090000";
319 323
    //  ==> (1998 9:00 AM EST)February 13;March 13;November 13
320 324
    //      (1999 9:00 AM EDT)August 13
......
327 331
    $result = implode(', ', $dates);
328 332
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
329 333

  
330
    //The first Saturday that follows the first Sunday of the month, forever:
334
    // The first Saturday that follows the first Sunday of the month, forever:
331 335
    //  ==> (1997 9:00 AM EDT)September 13;October 11
332 336
    //      (1997 9:00 AM EST)November 8;December 13
333 337
    //      (1998 9:00 AM EST)January 10;February 7;March 7
......
340 344
    $result = implode(', ', $dates);
341 345
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
342 346

  
343
    //Every four years, the first Tuesday after a Monday in November,
344
    //forever (U.S. Presidential Election day):
347
    // Every four years, the first Tuesday after a Monday in November,
348
    // forever (U.S. Presidential Election day):
345 349
    //  ==> (1996 9:00 AM EST)November 5
346 350
    //      (2000 9:00 AM EST)November 7
347 351
    //      (2004 9:00 AM EST)November 2
......
353 357
    $result = implode(', ', $dates);
354 358
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
355 359

  
356
    //Every 20th Monday of the year, forever:
360
    // Every 20th Monday of the year, forever:
357 361
    $start = "1997-05-19 09:00:00";
358 362
    $end = "2000-01-01 09:00:00";
359 363
    $rule = "RRULE:FREQ=YEARLY;BYDAY=20MO";
......
365 369
    $result = implode(', ', $dates);
366 370
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
367 371

  
368
    //Every Sunday in January, every other year, forever:
372
    // Every Sunday in January, every other year, forever:
369 373
    $start = "1997-01-05 09:00:00";
370 374
    $end = "2001-02-01 09:00:00";
371 375
    $rule = 'RRULE:FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU';
......
377 381
    $result = implode(', ', $dates);
378 382
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
379 383

  
380
    //Every Last Thursday in November, every year, five times:
384
    // Every Last Thursday in November, every year, five times:
381 385
    $start = "2014-11-27 00:00:00";
382 386
    $rule = 'FREQ=YEARLY;INTERVAL=1;BYDAY=-1TH;BYMONTH=11;COUNT=5;WKST=SU';
383 387
    //  ==> (2014 00:00 AM EDT)November 27
......
390 394
    $result = implode(', ', $dates);
391 395
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
392 396

  
393
return;
397
    return;
394 398

  
395
    //Every Thanksgiving, forever:
399
    // Every Thanksgiving, forever:
396 400
    $start = "1997-01-01 09:00:00";
397 401
    $end = "2001-02-01 09:00:00";
398 402
    $rule = 'RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYDAY=4TH';
......
404 408
    $result = implode(', ', $dates);
405 409
    $this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . ';  results: ' . $result);
406 410

  
407
// TODO:
408
// BYYEARDAY, BYSETPOS,
409
// BYHOUR, BYMINUTE, HOURLY, MINUTELY, SECONDLY
410
// have not yet been implemented in date_repeat.
411

  
412
//Every 3rd year on the 1st, 100th and 200th day for 10 occurrences:
413
$date = "DTSTART;TZID=US-Eastern:19970101T090000";
414
$rule = "RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200";
415
//  ==> (1997 9:00 AM EST)January 1
416
//      (1997 9:00 AM EDT)April 10;July 19
417
//      (2000 9:00 AM EST)January 1
418
//      (2000 9:00 AM EDT)April 9;July 18
419
//      (2003 9:00 AM EST)January 1
420
//      (2003 9:00 AM EDT)April 10;July 19
421
//      (2006 9:00 AM EST)January 1
422

  
423
//Monday of week number 20 (where the default start of the week is Monday), forever:
424
$date = "DTSTART;TZID=US-Eastern:19970512T090000";
425
$rule = "RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO";
426
//  ==> (1997 9:00 AM EDT)May 12
427
//      (1998 9:00 AM EDT)May 11
428
//      (1999 9:00 AM EDT)May 17
429

  
430
//The 3rd instance into the month of one of Tuesday, Wednesday or
431
//Thursday, for the next 3 months:
432
$date = "DTSTART;TZID=US-Eastern:19970904T090000";
433
$rule = "RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3";
434
//  ==> (1997 9:00 AM EDT)September 4;October 7
435
//      (1997 9:00 AM EST)November 6
436

  
437
//The 2nd to last weekday of the month:
438
$date = "DTSTART;TZID=US-Eastern:19970929T090000";
439
$rule = "RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2";
440
//  ==> (1997 9:00 AM EDT)September 29
441
//      (1997 9:00 AM EST)October 30;November 27;December 30
442
//      (1998 9:00 AM EST)January 29;February 26;March 30
443

  
444
//Every 3 hours from 9:00 AM to 5:00 PM on a specific day:
445
$date = "DTSTART;TZID=US-Eastern:19970902T090000";
446
$rule = "RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z";
447
//  ==> (September 2, 1997 EDT)09:00,12:00,15:00
448

  
449
//Every 15 minutes for 6 occurrences:
450
$date = "DTSTART;TZID=US-Eastern:19970902T090000";
451
$rule = "RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6";
452
//  ==> (September 2, 1997 EDT)09:00,09:15,09:30,09:45,10:00,10:15
453

  
454
//Every hour and a half for 4 occurrences:
455
$date = "DTSTART;TZID=US-Eastern:19970902T090000";
456
$rule = "RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4";
457
//  ==> (September 2, 1997 EDT)09:00,10:30;12:00;13:30
458

  
459
//Every 20 minutes from 9:00 AM to 4:40 PM every day:
460
$date = "DTSTART;TZID=US-Eastern:19970902T090000";
461
$rule = "RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40";
462
//  or
463
$rule = "RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16";
464
//  ==> (September 2, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
465
//      (September 3, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
466

  
411
    // TODO:
412
    // BYYEARDAY, BYSETPOS,
413
    // BYHOUR, BYMINUTE, HOURLY, MINUTELY, SECONDLY
414
    // have not yet been implemented in date_repeat.
415
    // Every 3rd year on the 1st, 100th and 200th day for 10 occurrences:
416
    $date = "DTSTART;TZID=US-Eastern:19970101T090000";
417
    $rule = "RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200";
418
    //  ==> (1997 9:00 AM EST)January 1
419
    //      (1997 9:00 AM EDT)April 10;July 19
420
    //      (2000 9:00 AM EST)January 1
421
    //      (2000 9:00 AM EDT)April 9;July 18
422
    //      (2003 9:00 AM EST)January 1
423
    //      (2003 9:00 AM EDT)April 10;July 19
424
    //      (2006 9:00 AM EST)January 1
425
    // Monday of week number 20 (where the default start of the week is Monday), forever:
426
    $date = "DTSTART;TZID=US-Eastern:19970512T090000";
427
    $rule = "RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO";
428
    //  ==> (1997 9:00 AM EDT)May 12
429
    //      (1998 9:00 AM EDT)May 11
430
    //      (1999 9:00 AM EDT)May 17
431
    // The 3rd instance into the month of one of Tuesday, Wednesday or
432
    // Thursday, for the next 3 months:
433
    $date = "DTSTART;TZID=US-Eastern:19970904T090000";
434
    $rule = "RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3";
435
    //  ==> (1997 9:00 AM EDT)September 4;October 7
436
    //      (1997 9:00 AM EST)November 6
437
    // The 2nd to last weekday of the month:
438
    $date = "DTSTART;TZID=US-Eastern:19970929T090000";
439
    $rule = "RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2";
440
    //  ==> (1997 9:00 AM EDT)September 29
441
    //      (1997 9:00 AM EST)October 30;November 27;December 30
442
    //      (1998 9:00 AM EST)January 29;February 26;March 30
443
    // Every 3 hours from 9:00 AM to 5:00 PM on a specific day:
444
    $date = "DTSTART;TZID=US-Eastern:19970902T090000";
445
    $rule = "RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z";
446
    //  ==> (September 2, 1997 EDT)09:00,12:00,15:00
447
    // Every 15 minutes for 6 occurrences:
448
    $date = "DTSTART;TZID=US-Eastern:19970902T090000";
449
    $rule = "RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6";
450
    //  ==> (September 2, 1997 EDT)09:00,09:15,09:30,09:45,10:00,10:15
451
    // Every hour and a half for 4 occurrences:
452
    $date = "DTSTART;TZID=US-Eastern:19970902T090000";
453
    $rule = "RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4";
454
    //  ==> (September 2, 1997 EDT)09:00,10:30;12:00;13:30
455
    // Every 20 minutes from 9:00 AM to 4:40 PM every day:
456
    $date = "DTSTART;TZID=US-Eastern:19970902T090000";
457
    $rule = "RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40";
458
    //  or.
459
    $rule = "RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16";
460
    //  ==> (September 2, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
461
    //      (September 3, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
467 462
  }
463

  
468 464
}

Formats disponibles : Unified diff