Skip to content

Commit e397dfa

Browse files
committed
Workaround for type checking issue
1 parent 96593b6 commit e397dfa

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

shiny/ui/_input_update.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ def update_date(
494494
msg = drop_none(msg)
495495

496496
# Handle the special case of "", which means the value should be cleared
497-
# (i.e., go from a specified date to no specified date)
497+
# (i.e., go from a specified date to no specified date).
498+
# This is equivalent to the NA case in R
498499
if value == "":
499500
msg["value"] = None
500501
if min == "":
@@ -550,26 +551,40 @@ def update_date_range(
550551
"""
551552

552553
session = require_active_session(session)
553-
value = {"start": _as_date_attr(start), "end": _as_date_attr(end)}
554+
554555
msg = {
555556
"label": session._process_ui(label) if label is not None else None,
556-
"value": drop_none(value),
557557
"min": _as_date_attr(min),
558558
"max": _as_date_attr(max),
559559
}
560+
560561
msg = drop_none(msg)
561562

562563
# Handle the special case of "", which means the value should be cleared
563-
# (i.e., go from a specified date to no specified date)
564-
if start == "":
565-
msg["value"]["start"] = None
566-
if end == "":
567-
msg["value"]["end"] = None
564+
# (i.e., go from a specified date to no specified date).
565+
# This is equivalent to the NA case in R
568566
if min == "":
569567
msg["min"] = None
570568
if max == "":
571569
msg["max"] = None
572570

571+
value = {
572+
"start": _as_date_attr(start),
573+
"end": _as_date_attr(end),
574+
}
575+
576+
value = drop_none(value)
577+
578+
# Handle the special case of "", which means the value should be cleared
579+
# (i.e., go from a specified date to no specified date)
580+
# This is equivalent to the NA case in R
581+
if start == "":
582+
value["start"] = None
583+
if end == "":
584+
value["end"] = None
585+
586+
msg["value"] = value
587+
573588
session.send_input_message(id, msg)
574589

575590

0 commit comments

Comments
 (0)