sxtwl_cpp icon indicating copy to clipboard operation
sxtwl_cpp copied to clipboard

阴历日期合理性检验

Open minchwu opened this issue 6 years ago • 4 comments

是否可以增加对阴历日期的合法性检验

比如,按阴历查询2018-12-31/32,查询结果依然存在而未报错
作者是否是按照计算参考某天的总天数,然后再计算日期的呀???

minchwu avatar Jan 10 '19 07:01 minchwu

已经增加,以异常的形式报出。 `import sxtwl lunar = sxtwl.Lunar()

try: lunar.getDayBySolar(2018, 13, 20) except sxtwl.LunarException as e : print(e.what())`

yuangu avatar Feb 22 '19 07:02 yuangu

pip python下载的模块没有更新。刚才看了下github上的最新代码 增加了上面的Exception https://github.com/yuangu/sxtwl_cpp/blob/master/python/sxtwl.py#L547 自己用swig编译测试了下日子和非法的月子。是可以跳出的。

except sxtwl.LunarException as e:
print(str(e))

不过好像没有年代范围呀。 例如

day0 = lunar.getDayBySolar(0,12,31)
day1 = lunar.getDayBySolar(1,12,31)
day_1 = lunar.getDayBySolar(-1,12,31)

正确的解应该是day0 和 day1 是同一年。只有公元1年。没有公元0年。公元1年可以理解为,BC1(-1年)

>>> day1.cur_mz
-161
>>> day0.cur_mz
-160

day1和day0应该是统一年的同一天。可是,到芒种节气的天数就差1天。是不是公元0年这块,有问题?

xros avatar Apr 05 '19 06:04 xros

额,没有意识到公元0年的问题,有空的时候。我改一下

发自我的 iPhone

在 2019年4月5日,下午2:08,xros [email protected] 写道:

pip python下载的模块没有更新。刚才看了下github上的最新代码 增加了上面的Exception https://github.com/yuangu/sxtwl_cpp/blob/master/python/sxtwl.py#L547 自己用swig编译测试了下日子和非法的月子。是可以跳出的。

except sxtwl.LunarException as e: print(str(e)) 不过好像没有年代范围呀。 例如

day0 = lunar.getDayBySolar(0,12,31) day1 = lunar.getDayBySolar(1,12,31) day_1 = lunar.getDayBySolar(-1,12,31) 正确的解应该是day0 和 day1 是同一年。只有公元1年。没有公元0年。公元1年可以理解为,BC1(-1年)

day1.cur_mz -161 day0.cur_mz -160 day1和day0应该是统一年的同一天。可是,到芒种节气的天数就差1天。是不是公元0年这块,有问题?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

yuangu avatar Apr 05 '19 15:04 yuangu

2019年4月5日~~开始改的呀~ 现在还没改好!

yinzhewuming avatar Jan 21 '22 10:01 yinzhewuming