Skip to content

Commit 3e5cf55

Browse files
authored
Merge pull request #474 from lsndr/next
Sync beta with next
2 parents bd7ebd2 + 0bb3668 commit 3e5cf55

File tree

10 files changed

+2020
-1482
lines changed

10 files changed

+2020
-1482
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ updates:
44
target-branch: 'next'
55
directory: '/'
66
schedule:
7-
interval: 'daily'
7+
interval: 'weekly'
88
- package-ecosystem: 'cargo'
99
target-branch: 'next'
1010
directory: '/'
1111
schedule:
12-
interval: 'daily'
12+
interval: 'weekly'

Cargo.lock

Lines changed: 30 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ path = "lib/lib.rs"
99

1010
[dependencies]
1111
chrono = "0.4.41"
12-
chrono-tz = "0.9.0"
13-
indexmap = "2.9.0"
12+
chrono-tz = "0.10.4"
13+
indexmap = "2.10.0"
1414
itertools = "0.14.0"
1515
# Default enable napi5 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
1616
napi = { version = "2.16.17", default-features = false, features = ["napi5"] }
1717
napi-derive = "2.16.13"
1818
replace_with = "0.1.8"
19-
rrule = { version = "0.13.0", features = ["exrule"] }
19+
rrule = { version = "0.14.0", features = ["exrule"] }
2020

2121
[build-dependencies]
22-
napi-build = "2.2.0"
22+
napi-build = "2.2.2"
2323

2424
[profile.release]
2525
lto = true

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@
55
[![npm downloads](https://img.shields.io/npm/dt/rrule-rust.svg)](https://www.npmjs.com/package/rrule-rust)
66
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lsndr/rrule-rust/blob/master/LICENSE.md)
77

8-
`rrule-rust` is a library for working with recurrence rules based on Rust's [rrule](https://crates.io/crates/rrule) crate
8+
`rrule-rust` is a library for handling recurrence rules, powered by Rust's high-performance [rrule](https://crates.io/crates/rrule) crate.
99

1010
1. [Quick Start](#quick-start)
1111
2. [Performance](#performance)
1212

1313
## Quick Start
1414

15-
See [test folder](https://github.com/lsndr/rrule-rust/tree/master/tests) to find more use cases
16-
1715
```
1816
npm i rrule-rust
1917
```
2018

19+
If you need a browser-compatible version with WASM support, install it from the `alpha` channel:
20+
21+
```
22+
npm i rrule-rust@alpha
23+
```
24+
25+
> The WebAssembly (WASM) version is currently available on the `alpha` channel, as it relies on an alpha release of [napi.rs](https://napi.rs/). Once napi.rs v3 is officially released, WASM support will be included in the main (`latest`) release channel.
26+
27+
For more usage examples and advanced scenarios, see the [tests directory](https://github.com/lsndr/rrule-rust/tree/master/tests) in the repository.
28+
2129
```typescript
2230
import { RRule, RRuleSet, Frequency, DateTime } from 'rrule-rust';
2331

@@ -32,7 +40,7 @@ const set = new RRuleSet({
3240
});
3341

3442
const dates = set.all(); // [ DateTime, DateTime, DateTime, DateTime, DateTime ]
35-
const asString = set.toString(); // DTSTART;TZID=US/Eastern:19970902T090000\nFREQ=daily;COUNT=5;BYHOUR=9;BYMINUTE=0;BYSECOND=0
43+
const asString = set.toString(); // DTSTART;TZID=US/Eastern:19970902T090000\nFREQ=DAILY;COUNT=5;BYHOUR=9;BYMINUTE=0;BYSECOND=0
3644
```
3745

3846
## Performance
@@ -49,7 +57,7 @@ const asString = set.toString(); // DTSTART;TZID=US/Eastern:19970902T090000\nFRE
4957
| UTC TZ | 15 904 ops/s | 108 538 ops/s | ~6x faster |
5058
| Other TZ | 260 ops/s | 106 034 ops/s | ~400x faster |
5159

52-
You can run benchmarks using `npm run benchmark`
60+
You can run benchmarks using `npm run benchmark`.
5361

5462
## License
5563

lib/rrule/dtstart.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ impl DtStart {
3434
let mut parameters = Parameters::new();
3535

3636
if let Some(tzid) = self.tzid {
37-
parameters.insert("TZID".to_string(), tzid.to_string());
37+
// UTC datetimes MUST NOT contain a TZID
38+
if !self.datetime.utc() {
39+
parameters.insert("TZID".to_string(), tzid.to_string());
40+
}
3841
}
3942

4043
let value: String = self.datetime.to_string();

lib/rrule/exdate.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl ExDate {
2626
let mut parameters = Parameters::new();
2727

2828
if let Some(tzid) = self.tzid {
29-
parameters.insert("TZID".to_string(), tzid.to_string());
29+
// UTC datetimes MUST NOT contain a TZID
30+
if !self.datetimes.iter().any(|datetime| datetime.utc()) {
31+
parameters.insert("TZID".to_string(), tzid.to_string());
32+
}
3033
}
3134

3235
let value: String = self

lib/rrule/rdate.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl RDate {
2626
let mut parameters = Parameters::new();
2727

2828
if let Some(tzid) = self.tzid {
29-
parameters.insert("TZID".to_string(), tzid.to_string());
29+
// UTC datetimes MUST NOT contain a TZID
30+
if !self.datetimes.iter().any(|datetime| datetime.utc()) {
31+
parameters.insert("TZID".to_string(), tzid.to_string());
32+
}
3033
}
3134

3235
let value: String = self

0 commit comments

Comments
 (0)