forked from coolaj86/rrecurjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-iterator.js
36 lines (32 loc) · 884 Bytes
/
test-iterator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*jshint -W054 */
(function (exports) {
'use strict';
var Rrecur = exports.Rrecur || require('./rrecur-iterator').Rrecur
, ruleObj
, recur
, i
, prev
;
ruleObj = {
freq: 'weekly'
, interval: '2'
//, dtstart: '2014-01-01T10:30:00Z' // beginning of year
, dtstart: '2014-05-16T10:30:00' // a month ago
, locale: 'GMT-0400 (EDT)'
//, tzid: "america/new-york"
//, dtstart: '2014-07-16T10:30:00Z' // in the future
, until: '2014-07-16T10:30:00Z'
, byday: [ 'tu', 'su' ]
, wkst: 'su'
};
recur = Rrecur.create(ruleObj, new Date('2014-06-22T10:30:00-0400'));
console.log('prev', recur.previous());
/*
do (prev = recur.previous()) {
console.log('prev', prev);
} while()
*/
for (i = 0; i < 10; i += 1) {
console.log(i, recur.next());
}
}('undefined' !== typeof exports && exports || new Function('return this')()));