From ec41f11d98ef0030ffbf719e051929a15698ad09 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Thu, 24 May 2018 22:28:06 -0400 Subject: [PATCH] Use Datetime --- src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7edf7f6..826a6e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,10 @@ +#![allow(dead_code)] + extern crate chrono; use chrono::DateTime; use chrono::Datelike; +use chrono::FixedOffset; use chrono::Local; use chrono::NaiveDateTime; use chrono::NaiveTime; @@ -674,7 +677,7 @@ impl Parser { default: Option, ignoretz: bool, tzinfos: Vec, - ) -> Result, ParseError> { + ) -> Result, ParseError> { let now = Local::now().naive_local(); let default_date = default.unwrap_or(now).date(); @@ -708,16 +711,17 @@ impl Parser { dt: NaiveDateTime, res: &ParsingResult, default: NaiveDateTime, - ) -> DateTime { - Utc::now() + ) -> DateTime { + + Local::now().with_timezone(&FixedOffset::east(0)) } } -fn parse_with_info(timestr: String, info: ParserInfo) -> Result, ParseError> { +fn parse_with_info(timestr: String, info: ParserInfo) -> Result, ParseError> { let parser = Parser::new(info); parser.parse(timestr, None, false, vec![]) } -fn parse(timestr: String) -> Result, ParseError> { +fn parse(timestr: String) -> Result, ParseError> { parse_with_info(timestr, ParserInfo::default()) }