Skip to content

Commit 33e290a

Browse files
authored
chore: Add support for Narwhals Time dtype in serialize_dtype (#1892)
1 parent 1ff586f commit 33e290a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

shiny/render/_data_frame_utils/_tbl_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ def serialize_dtype(col: nw.Series) -> FrameDtype:
202202
type_ = "datetime"
203203
elif isinstance(dtype, nw.Duration):
204204
type_ = "duration"
205+
elif hasattr(nw, "Time") and isinstance(
206+
dtype,
207+
# https://github.com/narwhals-dev/narwhals/pull/2113
208+
nw.Time, # pyright: ignore[reportUnknownMemberType,reportAttributeAccessIssue]
209+
):
210+
type_ = "time"
205211
elif isinstance(dtype, nw.Object):
206212
type_ = "object"
207213
if series_contains_htmltoolslike(col):

shiny/render/_data_frame_utils/_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class FrameDtypeSubset(TypedDict):
179179
"boolean",
180180
"date",
181181
"datetime",
182+
"time",
182183
"duration",
183184
"object",
184185
"unknown",

0 commit comments

Comments
 (0)