Skip to content

Commit

Permalink
feat: support holidays for 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
LKI committed Oct 25, 2023
1 parent 72feecf commit fd8ba9f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
## Latest Version 1.9.0
> on 2023-10-25
* **FEAT**: 支持 2024年 的节假日

## Version 1.8.1
> on 2023-07-03
* **FEAT**: 支持 Python3.11
* **FEAT**: `get_workdays` 函数新增 `include_weekends` 筛选,该筛选关闭后会过滤掉调休的周末,thanks @Dragon-GCS #104
* **CHORE**: 更新项目开发依赖

## Latest Version 1.8.0
## Version 1.8.0
> on 2022-12-09
* **FEAT**: 支持 2023年 的节假日
Expand Down
44 changes: 44 additions & 0 deletions chinese_calendar/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,34 @@ def __new__(cls, english, chinese, days):
datetime.date(year=2023, month=10, day=4): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=5): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=6): Holiday.national_day.value,
datetime.date(year=2024, month=1, day=1): Holiday.new_years_day.value,
datetime.date(year=2024, month=2, day=10): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=11): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=12): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=13): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=14): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=15): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=16): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=17): Holiday.spring_festival.value,
datetime.date(year=2024, month=4, day=4): Holiday.tomb_sweeping_day.value,
datetime.date(year=2024, month=4, day=5): Holiday.tomb_sweeping_day.value,
datetime.date(year=2024, month=4, day=6): Holiday.tomb_sweeping_day.value,
datetime.date(year=2024, month=5, day=1): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=2): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=3): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=4): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=5): Holiday.labour_day.value,
datetime.date(year=2024, month=6, day=10): Holiday.dragon_boat_festival.value,
datetime.date(year=2024, month=9, day=15): Holiday.mid_autumn_festival.value,
datetime.date(year=2024, month=9, day=16): Holiday.mid_autumn_festival.value,
datetime.date(year=2024, month=9, day=17): Holiday.mid_autumn_festival.value,
datetime.date(year=2024, month=10, day=1): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=2): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=3): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=4): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=5): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=6): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=7): Holiday.national_day.value,
}

workdays = {
Expand Down Expand Up @@ -692,6 +720,14 @@ def __new__(cls, english, chinese, days):
datetime.date(year=2023, month=6, day=25): Holiday.dragon_boat_festival.value,
datetime.date(year=2023, month=10, day=7): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=8): Holiday.national_day.value,
datetime.date(year=2024, month=2, day=4): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=18): Holiday.spring_festival.value,
datetime.date(year=2024, month=4, day=7): Holiday.tomb_sweeping_day.value,
datetime.date(year=2024, month=4, day=28): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=11): Holiday.labour_day.value,
datetime.date(year=2024, month=9, day=14): Holiday.mid_autumn_festival.value,
datetime.date(year=2024, month=9, day=29): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=12): Holiday.national_day.value,
}

in_lieu_days = {
Expand Down Expand Up @@ -827,4 +863,12 @@ def __new__(cls, english, chinese, days):
datetime.date(year=2023, month=6, day=23): Holiday.dragon_boat_festival.value,
datetime.date(year=2023, month=10, day=5): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=6): Holiday.national_day.value,
datetime.date(year=2024, month=2, day=15): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=16): Holiday.spring_festival.value,
datetime.date(year=2024, month=4, day=5): Holiday.tomb_sweeping_day.value,
datetime.date(year=2024, month=5, day=2): Holiday.labour_day.value,
datetime.date(year=2024, month=5, day=3): Holiday.labour_day.value,
datetime.date(year=2024, month=9, day=17): Holiday.mid_autumn_festival.value,
datetime.date(year=2024, month=10, day=4): Holiday.national_day.value,
datetime.date(year=2024, month=10, day=7): Holiday.national_day.value,
}
19 changes: 19 additions & 0 deletions chinese_calendar/scripts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ def __init__(self):
pass

# fmt: off
def _2024(self):
"""https://www.gov.cn/zhengce/content/202310/content_6911527.htm

This comment has been minimized.

Copy link
@Eskibear

Eskibear Oct 25, 2023

这么快!比香港记者跑得都快!

一、元旦:1月1日放假,与周末连休。
二、春节:2月10日至17日放假调休,共8天。2月4日(星期日)、2月18日(星期日)上班。
三、清明节:4月4日至6日放假调休,共3天。4月7日(星期日)上班。
四、劳动节:5月1日至5日放假调休,共5天。4月28日(星期日)、5月11日(星期六)上班。
五、端午节:6月10日放假,与周末连休。
六、中秋节:9月15日至17日放假调休,共3天。9月14日(星期六)上班。
七、国庆节:10月1日至7日放假调休,共7天。9月29日(星期日)、10月12日(星期六)上班。
"""
self.year_at(2024) \
.nyd().rest(1, 1) \
.sf().rest(2, 10).to(2, 17).work(2, 4).work(2, 18).in_lieu(2, 15).to(2, 16) \
.tsd().rest(4, 4).to(4, 6).work(4, 7).in_lieu(4, 5) \
.ld().rest(5, 1).to(5, 5).work(4, 28).work(5, 11).in_lieu(5, 2).to(5, 3) \
.dbf().rest(6, 10) \
.maf().rest(9, 15).to(9, 17).work(9, 14).in_lieu(9, 17) \
.nd().rest(10, 1).to(10, 7).work(9, 29).work(10, 12).in_lieu(10, 4).in_lieu(10, 7)

def _2023(self):
""" http://www.gov.cn/zhengce/content/2022-12/08/content_5730844.htm
一、元旦:2022年12月31日至2023年1月2日放假调休,共3天。
Expand Down

0 comments on commit fd8ba9f

Please sign in to comment.