You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
Avoid unnecessary slicing when parsing offset
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
+1
-1
@@ -318,7 +318,7 @@ pub fn parse_datetime_at_date<S: AsRef<str> + Clone>(
|
||||
for (fmt, n) in format::PATTERNS_OFFSET {
|
||||
if ts.len() == n + 12 {
|
||||
let f = format::YYYYMMDDHHMM.to_owned() + fmt;
|
||||
if let Ok(parsed) = DateTime::parse_from_str(&ts[0..n + 12], &f) {
|
||||
if let Ok(parsed) = DateTime::parse_from_str(&ts, &f) {
|
||||
return Ok(parsed);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user