(value: &Bound<'_, PyAny>)
| 352 | /// Prop: |
| 353 | #[staticmethod] |
| 354 | pub fn aware_datetime(value: &Bound<'_, PyAny>) -> PyResult<Self> { |
| 355 | if let Ok(dt) = value.extract::<DateTime<Utc>>() { |
| 356 | return Ok(PyProp(Prop::DTime(dt))); |
| 357 | } |
| 358 | if let Ok(naive) = value.extract::<NaiveDateTime>() { |
| 359 | return Ok(PyProp(Prop::DTime(naive.and_utc()))); |
| 360 | } |
| 361 | Err(PyTypeError::new_err(format!( |
| 362 | "Could not convert {value:?} to a datetime" |
| 363 | ))) |
| 364 | } |
| 365 | |
| 366 | /// Construct a `Prop` holding a naive (timezone-unaware) datetime. |
| 367 | /// |