mirror of
https://github.com/jhbruhn/ics-adapter.git
synced 2025-03-14 19:15:50 +00:00
Add support for more outlook timezones, read repeat amount from environmant var
This commit is contained in:
parent
fd1a1eb8c2
commit
cedac550fb
1 changed files with 5 additions and 1 deletions
|
@ -87,7 +87,8 @@ async fn convert(urls: &[&str], days: Option<&String>) -> Result<CustomCalendar>
|
||||||
let rrule_str = rrule.value();
|
let rrule_str = rrule.value();
|
||||||
let string = format!("DTSTART:{}\n{}", event.properties().get("DTSTART").unwrap().value(), rrule_str);
|
let string = format!("DTSTART:{}\n{}", event.properties().get("DTSTART").unwrap().value(), rrule_str);
|
||||||
let rrule: rrule::RRuleSet = string.parse()?;
|
let rrule: rrule::RRuleSet = string.parse()?;
|
||||||
let date_set = rrule.all(100).dates;
|
let repeats = std::env::var("RULE_REPEATS").ok().and_then(|x| x.parse().ok()).unwrap_or(100);
|
||||||
|
let date_set = rrule.all(repeats).dates;
|
||||||
date_set.iter().map(|x| x.with_timezone(&chrono::Utc)).collect()
|
date_set.iter().map(|x| x.with_timezone(&chrono::Utc)).collect()
|
||||||
} else {
|
} else {
|
||||||
vec!(start)
|
vec!(start)
|
||||||
|
@ -133,6 +134,9 @@ fn convert_time(dt: icalendar::DatePerhapsTime) -> Result<chrono::DateTime<chron
|
||||||
icalendar::CalendarDateTime::WithTimezone{date_time, tzid} => {
|
icalendar::CalendarDateTime::WithTimezone{date_time, tzid} => {
|
||||||
icalendar::CalendarDateTime::WithTimezone{date_time, tzid: String::from(match tzid.as_str() {
|
icalendar::CalendarDateTime::WithTimezone{date_time, tzid: String::from(match tzid.as_str() {
|
||||||
"W. Europe Standard Time" => "Europe/London",
|
"W. Europe Standard Time" => "Europe/London",
|
||||||
|
"Turkey Standard Time" => "Europe/Istanbul",
|
||||||
|
"India Standard Time" => "Asia/Kolkata",
|
||||||
|
"Pacific Standard Time" => "America/Los Angeles",
|
||||||
_ => &tzid
|
_ => &tzid
|
||||||
})}
|
})}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue