-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add runnable examples for dateparser (#5)
- Loading branch information
1 parent
bbced1d
commit db391c7
Showing
8 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "belt" | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
authors = ["Rollie Ma <[email protected]>"] | ||
edition = "2018" | ||
publish = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "dateparser" | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
authors = ["Rollie Ma <[email protected]>"] | ||
description = "Parse dates in string formats that are commonly used" | ||
readme = "README.md" | ||
|
@@ -14,3 +14,6 @@ edition = "2018" | |
anyhow = "1.0.40" | ||
chrono = "0.4" | ||
regex = "1.5.4" | ||
|
||
[dev-dependencies] | ||
chrono-tz = "0.5.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use chrono_tz::US::Pacific; | ||
use dateparser::DateTimeUtc; | ||
use std::error::Error; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let parsed = "2021-05-14 18:51 PDT".parse::<DateTimeUtc>()?.0; | ||
println!("{:#?}", parsed.with_timezone(&Pacific)); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use dateparser::parse; | ||
use std::error::Error; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let parsed = parse("6:15pm")?; | ||
println!("{:#?}", parsed); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use dateparser::DateTimeUtc; | ||
use std::error::Error; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let parsed = "2021-05-14 18:51 PDT".parse::<DateTimeUtc>()?.0; | ||
println!("{:#?}", parsed); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters