hoodie / icalendar-rs

📆 icalendar library, in Rust of course - for fun
Apache License 2.0
126 stars 33 forks source link

Cant use CalendarDateTime::from_ymd_hm_tzid #83

Closed HenningCode closed 11 months ago

HenningCode commented 11 months ago

Hello Guys,

I wanted to use this package to generate ical files and created this minimal file that still fails for me.

use chrono_tz::Europe::Berlin;
use icalendar::*;

mod helpers;

fn main() {

        let bday = Event::new()
            .starts(CalendarDateTime::from_ymd_hm_tzid(2023, 3, 15, 18, 45, Berlin).unwrap())
            .summary("Birthday Party")
            .description("I'm gonna have a party\nBYOB: Bring your own beer.\nHendrik")
            .done();

}

My Error message is: no variant or associated item namedfrom_ymd_hm_tzidfound for enumicalendar::CalendarDateTimein the current scope

Why is that? I am pretty new to Rust and i dont quite understand the problem I am facing.

This my cargo.toml

[dependencies]
icalendar = "0.15.8"
chrono-tz = "0.8.4"

[dependencies.chrono]
version = "0.4"
default_features = false
features = ["clock", "std", "wasmbind"]

Thanks for your help.

hoodie commented 11 months ago

you need to enable the chrono-tz feature in icalendar too. It's not on by default