Skip to content

Commit 3739ab6

Browse files
committed
fix: clarified condition
1 parent 18859f5 commit 3739ab6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

aws_lambda_powertools/utilities/feature_flags/time_conditions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def compare_time_range(action: str, values: Dict) -> bool:
4949
start_hour, start_min = values.get(TimeValues.START.value, "").split(HOUR_MIN_SEPARATOR)
5050
end_hour, end_min = values.get(TimeValues.END.value, "").split(HOUR_MIN_SEPARATOR)
5151

52-
start_datetime = current_time.replace(hour=int(start_hour), minute=int(start_min))
53-
end_datetime = current_time.replace(hour=int(end_hour), minute=int(end_min))
52+
start_time = current_time.replace(hour=int(start_hour), minute=int(start_min))
53+
end_time = current_time.replace(hour=int(end_hour), minute=int(end_min))
5454

5555
if int(end_hour) < int(start_hour):
5656
# When the end hour is smaller than start hour, it means we are crossing a day's boundary.
@@ -67,7 +67,7 @@ def compare_time_range(action: str, values: Dict) -> bool:
6767
# └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
6868
# │
6969

70-
return (start_datetime <= current_time) or (current_time <= end_datetime)
70+
return (start_time <= current_time) or (current_time <= end_time)
7171
else:
7272
# In normal circumstances, we need to assert **both** conditions
73-
return (start_datetime <= current_time) and (current_time <= end_datetime)
73+
return start_time <= current_time <= end_time

0 commit comments

Comments
 (0)