Skip to content

Commit 9bedf74

Browse files
committed
update byday
1 parent a4686e0 commit 9bedf74

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"deno.enable": true,
33
"cSpell.words": [
4+
"BYDAY",
45
"CALSCALE",
56
"DTEND",
67
"DTSTAMP",

mod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { Calendar, Event } from './main.ts';
22
export type { EventConfig } from './main.ts';
3+
export type { Day, RecurrenceRule } from './rrule.ts';

rrule.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ export interface RecurrenceRule {
55
until?: DateData;
66
interval?: number;
77
count?: number;
8+
byDay?: Day[];
89
}
910

1011
export function parseRRule(rrule: RecurrenceRule | undefined) {
1112
if (rrule === undefined) return;
1213

13-
const { freq, until, interval, count } = rrule;
14+
const { freq, until, interval, count, byDay } = rrule;
1415

1516
return [
1617
['FREQ', freq],
1718
['UNTIL', parseDate(until)],
1819
['INTERVAL', interval],
1920
['COUNT', count],
21+
['BYDAY', byDay ? byDay.join() : undefined],
2022
]
2123
.filter(line => line[1] !== undefined)
2224
.map(line => `${line[0]}=${line[1]};`)
2325
.join('');
2426
}
27+
28+
export type Day = 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU';

0 commit comments

Comments
 (0)