Skip to content

Commit 9117123

Browse files
Fix yearly calculation after resetting chore date to blank
1 parent 3c21261 commit 9117123

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

custom_components/chore_helper/config_flow.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ async def _validate_config(
2828
data[const.CONF_DAY_OF_MONTH] = None
2929

3030
if const.CONF_DATE in data:
31-
if data[const.CONF_DATE] == "0" or data[const.CONF_DATE] == "0/0":
32-
data[const.CONF_DATE] = ""
31+
if (
32+
data[const.CONF_DATE] == "0"
33+
or data[const.CONF_DATE] == "0/0"
34+
or data[const.CONF_DATE] == ""
35+
):
36+
data[const.CONF_DATE] = None
3337
else:
3438
try:
3539
helpers.month_day_text(data[const.CONF_DATE])

custom_components/chore_helper/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ def _find_candidate_date(self, day1: date) -> date | None:
836836
start_date = self._calculate_schedule_start_date()
837837
day1 = self.calculate_day1(day1, start_date)
838838
conf_date = self._date
839-
if conf_date is None:
839+
if conf_date is None or conf_date == "":
840840
conf_date = start_date
841841
else:
842842
conf_date = datetime.strptime(conf_date, "%m/%d")

0 commit comments

Comments
 (0)