rrule-temporal 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,5 +15,21 @@ npm install rrule-temporal
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
|
|
18
|
+
const ics = `DTSTART;TZID=America/Chicago:20250401T000000
|
|
19
|
+
RRULE:FREQ=DAILY;BYHOUR=0;BYMINUTE=0;UNTIL=20250405T000000Z`.trim();
|
|
20
|
+
const rule = new RRuleTemporal({ rruleString: ics });
|
|
21
|
+
const start = new Date(Date.UTC(2025, 3, 2, 0, 0)); // Apr 2 00:00 UTC
|
|
22
|
+
// after:
|
|
23
|
+
const end = new Date(
|
|
24
|
+
// 2025-04-04 00:00 America/Chicago → 05:00 UTC
|
|
25
|
+
Date.UTC(2025, 3, 4, 5, 0, 0)
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
test("between returns occurrences in window inclusive/exclusive", () => {
|
|
29
|
+
const arrExc = rule.between(start, end, false);
|
|
30
|
+
expect(arrExc.map((d) => d.day)).toEqual([2, 3]);
|
|
31
|
+
|
|
32
|
+
const arrInc = rule.between(start, end, true);
|
|
33
|
+
expect(arrInc.map((d) => d.day)).toEqual([2, 3, 4]);
|
|
34
|
+
});
|
|
19
35
|
```
|