refactor: use full filename when generate ics
This commit is contained in:
parent
2cd76c2dd6
commit
83e814eefd
|
|
@ -79,5 +79,5 @@ def generate_ics(data, filename):
|
|||
name = "上班(补" + name + ")"
|
||||
cal.add_component(create_event(name, start, end))
|
||||
|
||||
with open(f"{filename}.ics", "wb") as ics:
|
||||
with open(filename, "wb", encoding="utf8") as ics:
|
||||
ics.write(cal.to_ical())
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ def update_data(year: int) -> str:
|
|||
cls=CustomJSONEncoder,
|
||||
)
|
||||
|
||||
generate_ics(data, filename=f"{year}")
|
||||
generate_ics(data, filename=f"{year}.ics")
|
||||
return filename
|
||||
|
||||
|
||||
|
|
@ -86,7 +86,8 @@ def update_holiday_ics(fr_year, to_year):
|
|||
big_days.extend(data.get("days"))
|
||||
|
||||
generate_ics(
|
||||
{"days": sorted(big_days, key=lambda x: x["date"])}, filename="holiday-cn"
|
||||
{"days": sorted(big_days, key=lambda x: x["date"])},
|
||||
filename="holiday-cn.ics",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user