Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yuling0320 opened this issue Jan 28, 2025 · 1 comment
Open

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

yuling0320 opened this issue Jan 28, 2025 · 1 comment

Comments

@yuling0320
Copy link


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日,或日期不存在

@EillesWan
Copy link
Contributor

请不要重复提出issue,查看过往issue以解决问题,或者使用 zhDateTime 库

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants