Skip to content
Gedcomx date parser in rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.rusty-hooks.toml
Cargo.toml
LICENSE
README.md
circle.yml

README.md

gedcomx-date-rs

Circle CI

Gecomx date parsing written with nom in rust. See documentation here.

let date = gedcomx_date::parse("2015-06-26T16:43:23+02:00").unwrap();

Will give you:

GedcomxDate::Simple {
    date: Date {
        year: 2015,
        month: Some(6),
        day: Some(26),
    },
    time: Some(Time {
        hours: 16,
        minutes: Some(43),
        seconds: Some(23),
        tz_offset_hours: Some(2),
        tz_offset_minutes: Some(0),
    }),
};

Usage

Update your Cargo.toml:

[dependencies]
gedcomx_date = "0.0.1"
extern crate gedcomx_date;

fn main() {
    let date = gedcomx_date::parse("+1988-03-29T03:19+01");
    print!("{:?}", date);
}

TODO

  • don't cheat on the duration tests
  • validate dates (i.e. 30/02/2016)
  • validate hours (i.e. 24:31)
  • report parsing errors

License

MIT License Copyright (c) 2016 Nicolas Barbotte

You can’t perform that action at this time.