Skip to content

Commit

Permalink
fix(rust): fix iso_year for Date dtype (#5074)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 2, 2022
1 parent be5c600 commit d192e3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion polars/polars-time/src/chunkedarray/kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ to_temporal_unit!(
#[cfg(feature = "dtype-date")]
to_temporal_unit!(
date_to_iso_year,
week,
iso_year,
date32_to_datetime,
i32,
ArrowDataType::Int32
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/test_datelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,8 +1516,8 @@ def test_short_formats() -> None:


def test_iso_year() -> None:
dt = datetime(2022, 1, 1, 7, 8, 40)
assert pl.Series([dt]).dt.iso_year()[0] == 2021
assert pl.Series([datetime(2022, 1, 1, 7, 8, 40)]).dt.iso_year()[0] == 2021
assert pl.Series([date(2022, 1, 1)]).dt.iso_year()[0] == 2021


def test_invalid_date_parsing_4898() -> None:
Expand Down

0 comments on commit d192e3f

Please sign in to comment.