You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When extracting an ambiguous time from DateTime<Tz>, PyO3 will raise a ValueError. Snippet from chrono.rs:
let naive_dt = NaiveDateTime::new(py_date_to_naive_date(dt)?,py_time_to_naive_time(dt)?);
naive_dt.and_local_timezone(tz).single().ok_or_else(|| {PyValueError::new_err(format!("The datetime {:?} contains an incompatible or ambiguous timezone",
dt
))})
So if your Python datetime is datetime(2024, 11, 3, 1, 30, 0, tzinfo=ZoneInfo("America/Chicago"), fold=1), PyO3 will raise the ValueError.
However, in PEP 495 (added in Python 3.6), all time and datetime objects contain a fold attribute to disambiguate ambiguous times. So the above example should not be ambiguous.
We should be able to easily handle this by using chrono's LocalResult.Ambiguous enum.
The text was updated successfully, but these errors were encountered:
When extracting an ambiguous time from
DateTime<Tz>
, PyO3 will raise a ValueError. Snippet fromchrono.rs
:So if your Python datetime is
datetime(2024, 11, 3, 1, 30, 0, tzinfo=ZoneInfo("America/Chicago"), fold=1)
, PyO3 will raise the ValueError.However, in PEP 495 (added in Python 3.6), all
time
anddatetime
objects contain afold
attribute to disambiguate ambiguous times. So the above example should not be ambiguous.We should be able to easily handle this by using chrono's
LocalResult.Ambiguous
enum.The text was updated successfully, but these errors were encountered: