From 0ed1855b728a681234bd51d7952a66de6d5f7adc Mon Sep 17 00:00:00 2001 From: zxj Date: Wed, 10 Jul 2024 22:06:34 +0800 Subject: [PATCH] fix parse '2024-07-26 09:03:48+00' --- Cargo.toml | 2 +- src/datetime.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 889b087..b146f3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fastdate" -version = "0.3.29" +version = "0.3.30" edition = "2021" description = "Rust fast date carte" readme = "Readme.md" diff --git a/src/datetime.rs b/src/datetime.rs index 858335d..29edfeb 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -553,7 +553,13 @@ impl DateTime { } pub fn from_str_default(arg: &str, default_offset: i32) -> Result { - let mut v = arg.to_string(); + let mut v = { + let mut v = String::with_capacity(arg.len() + 6); + for x in arg.chars() { + v.push(x); + } + v + }; if v.len() == 10 { v.push_str("T00:00:00.00"); }