mirror of
https://github.com/bspeice/dtparse
synced 2024-12-22 04:18:09 -05:00
Remove timezone handling
There are too many issues in chrono-tz to make it worth supporting.
This commit is contained in:
parent
9f1b8d4971
commit
d5e0a5d46a
11
src/lib.rs
11
src/lib.rs
@ -977,15 +977,8 @@ impl Parser {
|
|||||||
*tzinfos.get(res.tzname.as_ref().unwrap()).unwrap(),
|
*tzinfos.get(res.tzname.as_ref().unwrap()).unwrap(),
|
||||||
)))
|
)))
|
||||||
} else if res.tzname.is_some() {
|
} else if res.tzname.is_some() {
|
||||||
let tzname = res.tzname.as_ref().unwrap();
|
println!("tzname {} identified but not understood.", tzname);
|
||||||
let tz: Result<Tz, String> = tzname.parse();
|
Ok(None)
|
||||||
if tz.is_ok() {
|
|
||||||
let offset = tz.unwrap().offset_from_local_datetime(dt).unwrap().fix();
|
|
||||||
Ok(Some(offset))
|
|
||||||
} else {
|
|
||||||
println!("tzname {} identified but not understood ({}). Ignoring for the time being, but behavior is subject to change.", tzname, tz.unwrap_err());
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::TimezoneUnsupported)
|
Err(ParseError::TimezoneUnsupported)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
mod fuzzing;
|
mod fuzzing;
|
||||||
mod pycompat_parser;
|
mod pycompat_parser;
|
||||||
mod pycompat_tokenizer;
|
mod pycompat_tokenizer;
|
||||||
mod tz;
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
use parse;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn est() {
|
|
||||||
// Issue originally reported in https://github.com/bspeice/dtparse/issues/18
|
|
||||||
let dt = parse("Fri, 21 Aug 2015 18:37:44 EST");
|
|
||||||
|
|
||||||
assert!(dt.is_ok());
|
|
||||||
assert!(dt.unwrap().1.is_some());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn cest() {
|
|
||||||
// Issue originally reported in https://github.com/bspeice/dtparse/issues/18
|
|
||||||
let dt = parse("Fri, 21 Aug 2015 18:37:44 CEST");
|
|
||||||
|
|
||||||
assert!(dt.is_ok());
|
|
||||||
// TODO: Fix
|
|
||||||
// assert!(dt.unwrap().1.is_some());
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user