Skip to content

无法转换2025年1月28日 #12

Description

@yuling0320

TypeError Traceback (most recent call last)
Cell In[11], line 3
1 from zhdate import ZhDate
2 #zhd = ZhDate.today().chinese().split(' ')[0][5:]
----> 3 zhd = ZhDate.today()
4 print(zhd)

File /opt/conda/lib/python3.11/site-packages/zhdate/init.py:164, in ZhDate.today()
162 @staticmethod
163 def today():
--> 164 return ZhDate.from_datetime(datetime.now())

File /opt/conda/lib/python3.11/site-packages/zhdate/init.py:160, in ZhDate.from_datetime(dt)
157 if (year_code & 0xf) != 0 and month == (year_code & 0xf) + 1:
158 leap_month = True
--> 160 return ZhDate(lunar_year, lunar_month, lunar_day, leap_month)

File /opt/conda/lib/python3.11/site-packages/zhdate/init.py:111, in ZhDate.init(self, lunar_year, lunar_month, lunar_day, leap_month)
100 """初始化函数
101
102 Arguments:
(...)
108 leap_month {bool} -- 是否是在农历闰月中 (default: {False})
109 """
110 if not ZhDate.validate(lunar_year, lunar_month, lunar_day, leap_month):
--> 111 raise TypeError('农历日期不支持,超出农历1900年1月1日至2100年12月29日,或日期不存在')
112 self.lunar_year = lunar_year
113 self.lunar_month = lunar_month

TypeError: 农历日期不支持,超出农历1900年1月1日至2100年12月29日,或日期不存在

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions