Skip to content

Commit

Permalink
1. 修复跨年 阴历不显示
Browse files Browse the repository at this point in the history
2. 增加显示数量到5
  • Loading branch information
Uber committed Jan 8, 2024
1 parent 82b880c commit 910eaff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/chineseholiday/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ def anniversary_handle(l,age):
day = int(key[2:])
age = -1

solar_date = lunar.CalendarToday.lunar_to_solar(self._lunar.solar()[0],month,day)#下标和位置
solar_date = lunar.CalendarToday.lunar_to_solar(self._lunar.lunar()[0],month,day)#下标和位置

date_str = solar_date.strftime('%Y%m%d')
self._lunar = lunar.CalendarToday()
try:
l = anniversaries[date_str]
except Exception as e:
Expand Down Expand Up @@ -522,7 +524,7 @@ def _update(self):
self.localizedAttributes['纪念日'] = custom

#这里传的数字 控制 显示几个 自定义的纪念日
results = self.calculate_anniversary(3)
results = self.calculate_anniversary(5)
_LOGGER.info(f'anniversaries: ${results}')

self.attributes['next_anniversaries'] = []
Expand Down

0 comments on commit 910eaff

Please sign in to comment.