Function gedcomx_date::parse

source ·
pub fn parse(string: &str) -> Result<GedcomxDate, String>
Expand description

Parses a string and extracts a Gedcomx date.

Example

use gedcomx_date::{parse, GedcomxDate};
let date = parse("+1988-03-29T03:19").unwrap();
match date {
    GedcomxDate::Simple(simple_date) => {
        let date = simple_date.date;
        println!("{}", date.year); // 1988
        println!("{}", date.month.unwrap()); // 3
        println!("{}", date.day.unwrap()); // 29
        let time = simple_date.time.unwrap();
        println!("{}", time.hours); // 3
        println!("{}", time.minutes.unwrap()); // 19
    },
   _ => {}
}