Skip to content

Commit 673d5b6

Browse files
committed
rename from humantime_to_duration to parse_datetime
1 parent 83e1431 commit 673d5b6

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
2-
name = "humantime_to_duration"
2+
name = "parse_datetime"
33
description = " parsing human-readable relative time strings and converting them to a Duration"
44
version = "0.3.1"
55
edition = "2021"
66
license = "MIT"
7-
repository = "https://github.com/uutils/humantime_to_duration"
7+
repository = "https://github.com/uutils/parse_datetime"
88
readme = "README.md"
99

1010
[dependencies]

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# humantime_to_duration
1+
# parse_datetime
22

3-
[![Crates.io](https://img.shields.io/crates/v/humantime_to_duration.svg)](https://crates.io/crates/humantime_to_duration)
4-
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/humantime_to_duration/blob/main/LICENSE)
5-
[![CodeCov](https://codecov.io/gh/uutils/humantime_to_duration/branch/main/graph/badge.svg)](https://codecov.io/gh/uutils/humantime_to_duration)
3+
[![Crates.io](https://img.shields.io/crates/v/parse_datetime.svg)](https://crates.io/crates/parse_datetime)
4+
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/parse_datetime/blob/main/LICENSE)
5+
[![CodeCov](https://codecov.io/gh/uutils/parse_datetime/branch/main/graph/badge.svg)](https://codecov.io/gh/uutils/parse_datetime)
66

77
A Rust crate for parsing human-readable relative time strings and converting them to a `Duration`, or parsing human-readable datetime strings and converting them to a `DateTime`.
88

@@ -20,12 +20,12 @@ Add this to your `Cargo.toml`:
2020

2121
```toml
2222
[dependencies]
23-
humantime_to_duration = "0.3.0"
23+
parse_datetime = "0.3.0"
2424
```
2525

2626
Then, import the crate and use the `from_str` and `from_str_at_date` functions:
2727
```rs
28-
use humantime_to_duration::{from_str, from_str_at_date};
28+
use parse_datetime::{from_str, from_str_at_date};
2929
use chrono::Duration;
3030

3131
let duration = from_str("+3 days");
@@ -41,7 +41,7 @@ assert_eq!(
4141

4242
For DateTime parsing, import the `parse_datetime` module:
4343
```rs
44-
use humantime_to_duration::parse_datetime::from_str;
44+
use parse_datetime::parse_datetime::from_str;
4545
use chrono::{Local, TimeZone};
4646

4747
let dt = from_str("2021-02-14 06:37:47");

fuzz/Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ libfuzzer-sys = "0.4"
1212
regex = "1.8.4"
1313
chrono = "0.4"
1414

15-
[dependencies.humantime_to_duration]
15+
[dependencies.parse_datetime]
1616
path = "../"
1717

1818
[[bin]]

fuzz/fuzz_targets/from_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ use libfuzzer_sys::fuzz_target;
44

55
fuzz_target!(|data: &[u8]| {
66
let s = std::str::from_utf8(data).unwrap_or("");
7-
let _ = humantime_to_duration::from_str(s);
7+
let _ = parse_datetime::from_str(s);
88
});

fuzz/fuzz_targets/parse_datetime_from_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ use libfuzzer_sys::fuzz_target;
44

55
fuzz_target!(|data: &[u8]| {
66
let s = std::str::from_utf8(data).unwrap_or("");
7-
let _ = humantime_to_duration::parse_datetime::from_str(s);
7+
let _ = parse_datetime::parse_datetime::from_str(s);
88
});

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl From<RegexError> for ParseDurationError {
5050
///
5151
/// ```
5252
/// use chrono::Duration;
53-
/// let duration = humantime_to_duration::from_str("+3 days");
53+
/// let duration = parse_datetime::from_str("+3 days");
5454
/// assert_eq!(duration.unwrap(), Duration::days(3));
5555
/// ```
5656
///
@@ -85,7 +85,7 @@ impl From<RegexError> for ParseDurationError {
8585
///
8686
/// ```
8787
/// use chrono::Duration;
88-
/// use humantime_to_duration::{from_str, ParseDurationError};
88+
/// use parse_datetime::{from_str, ParseDurationError};
8989
///
9090
/// assert_eq!(from_str("1 hour, 30 minutes").unwrap(), Duration::minutes(90));
9191
/// assert_eq!(from_str("tomorrow").unwrap(), Duration::days(1));
@@ -112,7 +112,7 @@ pub fn from_str(s: &str) -> Result<Duration, ParseDurationError> {
112112
///
113113
/// ```
114114
/// use chrono::{Duration, NaiveDate, Utc, Local};
115-
/// use humantime_to_duration::{from_str_at_date, ParseDurationError};
115+
/// use parse_datetime::{from_str_at_date, ParseDurationError};
116116
/// let today = Local::now().date().naive_local();
117117
/// let yesterday = today - Duration::days(1);
118118
/// assert_eq!(

src/parse_datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ mod format {
3636
///
3737
/// ```
3838
/// use chrono::{DateTime, Utc, TimeZone};
39-
/// let time = humantime_to_duration::parse_datetime::from_str("2023-06-03 12:00:01Z");
39+
/// let time = parse_datetime::parse_datetime::from_str("2023-06-03 12:00:01Z");
4040
/// assert_eq!(time.unwrap(), Utc.with_ymd_and_hms(2023, 06, 03, 12, 00, 01).unwrap());
4141
/// ```
4242
///

tests/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use chrono::{Duration, Utc};
2-
use humantime_to_duration::{from_str, from_str_at_date, ParseDurationError};
2+
use parse_datetime::{from_str, from_str_at_date, ParseDurationError};
33

44
#[test]
55
fn test_invalid_input() {

0 commit comments

Comments
 (0)