(values: Vec<String>)
| 24 | } |
| 25 | |
| 26 | pub fn parse_naive_datetimes(values: Vec<String>) -> PyResult<Vec<chrono::NaiveDateTime>> { |
| 27 | values |
| 28 | .into_iter() |
| 29 | .map(|v| { |
| 30 | chrono::NaiveDateTime::parse_from_str(&v, "%Y-%m-%d %H:%M:%S").map_err(|e| { |
| 31 | PyValueError::new_err(format!( |
| 32 | "invalid datetime '{v}' (expected '%Y-%m-%d %H:%M:%S'): {e}" |
| 33 | )) |
| 34 | }) |
| 35 | }) |
| 36 | .collect() |
| 37 | } |
| 38 | |
| 39 | pub fn format_naive_datetimes(values: Vec<chrono::NaiveDateTime>) -> Vec<String> { |
| 40 | values.into_iter().map(|v| v.format("%Y-%m-%d %H:%M:%S").to_string()).collect() |
no outgoing calls
no test coverage detected