Skip to content

Commit 54175b9

Browse files
committed
Bump chrono and reorder attemps accordingly to its new relaxed parser
1 parent 1975e76 commit 54175b9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ repository = "https://github.com/rust-syndication/diligent-date-parser"
1212
documentation = "https://docs.rs/diligent-date-parser/"
1313

1414
[dependencies]
15-
chrono = { version = "0.4", default-features = false }
15+
chrono = { version = "0.4.27", default-features = false }

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ fn utc_date(string: &str, format: &str) -> Option<DateTime<FixedOffset>> {
8181
pub fn parse_date(string: &str) -> Option<DateTime<FixedOffset>> {
8282
let trimmed = string.trim();
8383
None.or_else(|| rfc3339(trimmed))
84-
.or_else(|| cut(trimmed, 20).and_then(rfc3339))
85-
.or_else(|| cut(trimmed, 19).map(|s| suffix(s, "Z")).and_then(rfc3339))
8684
.or_else(|| DateTime::parse_from_str(trimmed, "%Y-%m-%d %H:%M:%S%.3f %z").ok())
8785
.or_else(|| utc_datetime(trimmed, "%Y-%m-%d %H:%M:%S%.3f"))
86+
.or_else(|| cut(trimmed, 20).and_then(rfc3339))
87+
.or_else(|| cut(trimmed, 19).map(|s| suffix(s, "Z")).and_then(rfc3339))
8888
.or_else(|| {
8989
cut(trimmed, 16)
9090
.map(|s| suffix(s, ":00Z"))

0 commit comments

Comments
 (0)