| 1 | use crate::{tests::common::check_occurrences, RRuleSet}; |
| 2 | |
| 3 | #[test] |
| 4 | fn daylight_savings_1() { |
| 5 | let rrule: RRuleSet = |
| 6 | "DTSTART;TZID=America/Vancouver:20210301T022210\nRRULE:FREQ=DAILY;COUNT=30" |
| 7 | .parse() |
| 8 | .unwrap(); |
| 9 | |
| 10 | let dates = rrule.all_unchecked(); |
| 11 | check_occurrences( |
| 12 | &dates, |
| 13 | &[ |
| 14 | "2021-03-01T02:22:10-08:00", |
| 15 | "2021-03-02T02:22:10-08:00", |
| 16 | "2021-03-03T02:22:10-08:00", |
| 17 | "2021-03-04T02:22:10-08:00", |
| 18 | "2021-03-05T02:22:10-08:00", |
| 19 | "2021-03-06T02:22:10-08:00", |
| 20 | "2021-03-07T02:22:10-08:00", |
| 21 | "2021-03-08T02:22:10-08:00", |
| 22 | "2021-03-09T02:22:10-08:00", |
| 23 | "2021-03-10T02:22:10-08:00", |
| 24 | "2021-03-11T02:22:10-08:00", |
| 25 | "2021-03-12T02:22:10-08:00", |
| 26 | "2021-03-13T02:22:10-08:00", |
| 27 | "2021-03-14T03:22:10-07:00", |
| 28 | "2021-03-15T02:22:10-07:00", |
| 29 | "2021-03-16T02:22:10-07:00", |
| 30 | "2021-03-17T02:22:10-07:00", |
| 31 | "2021-03-18T02:22:10-07:00", |
| 32 | "2021-03-19T02:22:10-07:00", |
| 33 | "2021-03-20T02:22:10-07:00", |
| 34 | "2021-03-21T02:22:10-07:00", |
| 35 | "2021-03-22T02:22:10-07:00", |
| 36 | "2021-03-23T02:22:10-07:00", |
| 37 | "2021-03-24T02:22:10-07:00", |
| 38 | "2021-03-25T02:22:10-07:00", |
| 39 | "2021-03-26T02:22:10-07:00", |
| 40 | "2021-03-27T02:22:10-07:00", |
| 41 | "2021-03-28T02:22:10-07:00", |
| 42 | "2021-03-29T02:22:10-07:00", |
| 43 | "2021-03-30T02:22:10-07:00", |
| 44 | ], |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | #[test] |
| 49 | fn daylight_savings_2() { |
| 50 | let dates = "DTSTART;TZID=Europe/Paris:20210214T093000\n\ |
| 51 | RRULE:FREQ=WEEKLY;UNTIL=20210508T083000Z;INTERVAL=2;BYDAY=MO;WKST=MO" |
| 52 | .parse::<RRuleSet>() |
| 53 | .unwrap() |
| 54 | .all(u16::MAX) |
| 55 | .dates; |
| 56 | check_occurrences( |
| 57 | &dates, |
| 58 | &[ |
| 59 | "2021-02-22T09:30:00+01:00", |
| 60 | "2021-03-08T09:30:00+01:00", |
| 61 | "2021-03-22T09:30:00+01:00", |
| 62 | "2021-04-05T09:30:00+02:00", // Switching to daylight saving time. |
| 63 | "2021-04-19T09:30:00+02:00", |
| 64 | "2021-05-03T09:30:00+02:00", |
| 65 | ], |
| 66 | ); |
| 67 | } |