LKI / chinese-calendar

判断一天是不是法定节假日/法定工作日(查看节假日安排)
https://pypi.org/project/chinesecalendar/
MIT License
1.06k stars 185 forks source link

2005年holiday判断问题 #70

Closed shirleysheng closed 3 years ago

shirleysheng commented 3 years ago

您好,在对2005年-2013年日期进行判断时发现很多个周末会被判断为节假日 例如is_holiday(datetime.date(2005, 1, 16)) 返回True chinese_calendar.get_holiday_detail(datetime.date(2005, 1, 16)) 返回(True, None) 这是什么情况呢

LKI commented 3 years ago

is_holiday 的判定是包括普通周末的~ 相当于判定,中国大陆的普通人在那天会不会工作~

def is_holiday(date):
    """
    check if one date is holiday in China.
    in other words, Chinese people get rest at that day.
    :type date: datetime.date | datetime.datetime
    :rtype: bool
    """

假如要判定是因为普通周末,还是因为节假日的话, 需要用 get_holiday_detail 函数的第二个参数判定。

chinese_calendar.get_holiday_detail(datetime.date(2005, 1, 16)) 返回(True, None)

比如这个就代表05年1月16日放假是因为普通周末~

shirleysheng commented 3 years ago

get!感谢