Skip to content

Commit c8ea654

Browse files
committed
Server: update TimePair to auto-sort tuples
1 parent bf54210 commit c8ea654

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class TimeSet:
111111
time_type: str
112112
time_values: Union[bool, TimeValues]
113113

114+
def __post_init__(self):
115+
if isinstance(self.time_values, list):
116+
self.time_values = [(min(time_value), max(time_value)) if isinstance(time_value, tuple) else time_value for time_value in self.time_values]
117+
114118
@property
115119
def is_week(self) -> bool:
116120
return self.time_type == 'week'

0 commit comments

Comments
 (0)