forked from jkbrzt/rrule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
435 lines (404 loc) · 16.3 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
<!doctype html>
<!-- GitHub pages homepage -->
<html>
<head>
<title>rrule.js demo</title>
<link rel="stylesheet" href="tests/demo/demo.css"/>
<script src="tests/vendor/jquery.js"></script>
<script src="tests/vendor/underscore.js"></script>
<script src="lib/rrule.js"></script>
<script src="lib/nlp.js"></script>
<script type="text/javascript" src="tests/demo/demo.js"></script>
</head>
<body>
<div id="page">
<p>
<a href="tests/index.html">Test suite</a> |
<a href="https://github.com/jkbr/rrule">Code and docs</a>
</p>
<h1><code>rrule.js</code> demo</h1>
<section id="intro">
<p>
This is a demo and test app for <code>rrule.js</code>, a JavaScript library
for working with recurrence rules for calendar dates.
</p>
</section>
<section id="output">
<h2>Output</h2>
<table>
<tr>
<th><code>rule =</code></th>
<td>
<pre id="init"></pre>
</td>
</tr>
<tr>
<th><code>rule.origOptions</code></th>
<td>
<pre id="options-output"></pre>
</td>
</tr>
<tr>
<th><code>rule.toString()</code></th>
<td>
<pre id="rfc-output"><a href=""></a></pre>
</td>
</tr>
<tr>
<th><code>rule.toText()</code></th>
<td>
<em id="text-output"><a href=""></a></em>
</td>
</tr>
<tr>
<th><code>rule.all()</code></th>
<td>
<table id="dates"></table>
</td>
</tr>
</table>
</section>
<div id="input">
<h2>Input</h2>
<div id="tabs"></div>
<div id="input-types">
<section id="options-input">
<h3>Options</h3>
<form>
<table>
<tbody>
<tr>
<th>
<div class="option-name"><code>freq</code>
<div class="help">Frequency</div>
</div>
</th>
<td>
<label><input name="freq" type="radio" value="0" />RRule.YEARLY</label>
<label><input name="freq" type="radio" value="1" />RRule.MONTHLY</label>
<label><input name="freq" type="radio" value="2" checked />RRule.WEEKLY</label>
<label><input name="freq" type="radio" value="3" />RRule.DAILY</label>
<label><input name="freq" type="radio" value="4" />RRule.HOURLY</label>
<label><input name="freq" type="radio" value="5" />RRule.MINUTELY</label>
<label><input name="freq" type="radio" value="6" />RRule.SECONDLY</label>
</td>
</tr>
<tr>
<th>
<div class="option-name"><code>dtstart</code>
<div class="help">The recurrence start. Besides being the
base for the recurrence, missing parameters in the
final recurrence instances will also be extracted from
this date. If not given, <code>new Date</code> will be
used instead.
</div>
</div>
</th>
<td><input name="dtstart" type="datetime-local"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>until</code>
<div class="help">If given, this must be a
<code>Date</code>
instance, that will
specify
the limit of the recurrence. If a recurrence instance
happens
to be the same as the <code>Date</code> instance given
in the
<code>until</code>
argument, this will be the last occurrence.
</div>
</div>
</th>
<td><input type="datetime-local" name="until"/>
</td>
</tr>
<tr>
<th>
<div class="option-name"><code>count</code>
<div class="help">How many occurrences will be generated.
</div>
</div>
</th>
<td><input type="number" max="1000" min="1" value="30" name="count"/>
</td>
</tr>
<tr>
<th>
<div class="option-name"><code>interval</code>
<div class="help">The interval between each freq iteration.
For example, when using <code>RRule.YEARLY</code>, an
interval of <code>2</code> means once every two years,
but with <code>RRule.HOURLY</code>, it means once every
two hours. The default interval is <code>1</code>.
</div>
</div>
</th>
<td><input type="number" value="1" min="1" name="interval"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>wkst</code>
<div class="help"> The week start day. Must be one of the
<code>RRule.MO</code>, <code>RRule.TU</code>,
<code>RRule.WE</code>
constants, or an integer, specifying the first day of
the week. This will affect recurrences based on weekly
periods. The default week start is
<code>RRule.MO</code>.
</div>
</div>
</th>
<td>
<label><input type="radio" name="wkst" value="0" checked />RRule.MO</label>
<label><input type="radio" name="wkst" value="1" />RRule.TU</label>
<label><input type="radio" name="wkst" value="2" />RRule.WE</label>
<label><input type="radio" name="wkst" value="3" />RRule.TH</label>
<label><input type="radio" name="wkst" value="4" />RRule.FR</label>
<label><input type="radio" name="wkst" value="5" />RRule.SA</label>
<label><input type="radio" name="wkst" value="6" />RRule.SU</label>
</td>
</tr><tr>
<th>
<div class="option-name"><code>byweekday</code>
<div class="help">If given, it must be either an integer
(<code>0
== RRule.MO</code>),
a
sequence of integers, one of the weekday constants
(<code>RRule.MO</code>,
<code>RRule.TU</code>, etc), or a sequence of these
constants.
When
given,
these variables will define the weekdays where the
recurrence
will be applied. It's also possible to use an argument
n
for
the weekday instances, which will mean the nth
occurrence
of
this weekday in the period. For example, with
<code>RRule.MONTHLY</code>,
or with <code>RRule.YEARLY</code> and
<code>BYMONTH</code>,
using
<code>RRule.FR.clone(+1)</code> in
<code>byweekday</code> will
specify
the
first friday of the month where the recurrence happens.
Notice
that the RFC documentation, this is specified as
<code>BYDAY</code>,
but was renamed to avoid the ambiguity of that
argument.
</div>
</div>
</th>
<td>
<label><input type="checkbox" name="byweekday" value="0">RRule.MO</label>
<label><input type="checkbox" name="byweekday" value="1">RRule.TU</label>
<label><input type="checkbox" name="byweekday" value="2">RRule.WE</label>
<label><input type="checkbox" name="byweekday" value="3">RRule.TH</label>
<label><input type="checkbox" name="byweekday" value="4">RRule.FR</label>
<label><input type="checkbox" name="byweekday" value="5">RRule.SA</label>
<label><input type="checkbox" name="byweekday" value="6">RRule.SU</label>
</td>
</tr>
<tr>
<th>
<div class="option-name"><code>bymonth</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the months to apply the recurrence
to.
</div>
</div>
</th>
<td>
<label><input name="bymonth" type="checkbox" value="1"/> Jan</label>
<label><input name="bymonth" type="checkbox" value="2"/> Feb</label>
<label><input name="bymonth" type="checkbox" value="3"/> Mar</label>
<label><input name="bymonth" type="checkbox" value="4"/> Apr</label>
<label><input name="bymonth" type="checkbox" value="5"/> May</label>
<label><input name="bymonth" type="checkbox" value="6"/> Jun</label>
<label><input name="bymonth" type="checkbox" value="7"/> Jul</label>
<label><input name="bymonth" type="checkbox" value="8"/> Aug</label>
<label><input name="bymonth" type="checkbox" value="9"/> Sep</label>
<label><input name="bymonth" type="checkbox" value="10"/> Oct</label>
<label><input name="bymonth" type="checkbox" value="11"/> Nov</label>
<label><input name="bymonth" type="checkbox" value="12"/> Dec</label>
</td>
</tr>
<tr>
<th>
<div class="option-name"><code>bysetpos</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, positive or negative. Each given integer will
specify
an occurrence number, corresponding to the nth
occurrence
of
the rule inside the frequency period. For example, a
<code>bysetpos</code> of <code>-1</code> if combined
with a
<code>RRule.MONTHLY</code>
frequency, and a byweekday of (<code>RRule.MO</code>,
<code>RRule.TU</code>,
<code>RRule.WE</code>, <code>RRule.TH</code>,
<code>FR</code>),
will
result
in the last
work day of every month.
</div>
</div>
</th>
<td><input name="bysetpos"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>bymonthday</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the month days to apply the
recurrence
to.
</div>
</div>
</th>
<td><input name="bymonthday"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>byyearday</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the year days to apply the recurrence
to.
</div>
</div>
</th>
<td><input name="byyearday"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>byweekno</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the week numbers to apply the
recurrence
to.
Week numbers have the meaning described in ISO8601,
that
is,
the first week of the year is that containing at least
four
days of the new year.
</div>
</div>
</th>
<td><input name="byweekno"></td>
</tr>
<tr>
<th>
<div class="option-name"><code>byhour</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the hours to apply the recurrence to.
</div>
</div>
</th>
<td><input name="byhour"></td>
</tr>
<tr>
<th>
<div class="option-name"><code>byminute</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the minutes to apply the recurrence
to.
</div>
</div>
</th>
<td><input name="byminute"/></td>
</tr>
<tr>
<th>
<div class="option-name"><code>bysecond</code>
<div class="help">If given, it must be either an integer,
or a
sequence of
integers, meaning the seconds to apply the recurrence
to.
</div>
</div>
</th>
<td><input name="bysecond"></td>
</tr>
<tr>
<th>
<div class="option-name"><code>byeaster</code>
<div class="help">
This is an extension to the RFC specification which the
Python
implementation provides.
<strong>Not implemented in the JavaScript
version.</strong>
</div>
</div>
</th>
<td>
<input disabled>
</td>
</tr>
</tbody>
</table>
</form>
</section>
<section id="rfc-input">
<h3><code>RRULE</code> string</h3>
<p><input value="FREQ=DAILY;INTERVAL=2;COUNT=4"/></p>
<p>
Enter an <code>RRULE</code> as per <a href="http://www.kanzaki.com/docs/ical/rrule.html">iCalendar RFC</a>.
</p>
<p>Examples:</p>
<ul class="examples">
<li><code>FREQ=WEEKLY;BYDAY=MO,WE</code></li>
<li><code>FREQ=MONTHLY;BYMONTHDAY=10,15;COUNT=20</code></li>
<li><code>FREQ=DAILY;INTERVAL=3;COUNT=10</code></li>
<li><code>FREQ=MONTHLY;BYDAY=-2FR;COUNT=7</code></li>
</ul>
</section>
<section id="text-input">
<h3>Text input</h3>
<p>
<input value="Every 2 weeks on Friday for 6 times" />
</p>
<p>Examples:</p>
<ul class="examples">
<li><code>Every weekday</code></li>
<li><code>Every 2 weeks on Tuesday</code></li>
<li><code>Every week on Monday, Wednesday</code></li>
<li><code>Every month on the 2nd last Friday for 7 times</code></li>
<li><code>Every 6 months</code></li>
</ul>
</section>
</div>
</div>
</div>
<a href="https://github.com/jkbr/rrule"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
</body>
</html>