6tail / lunar-java

日历、公历(阳历)、农历(阴历、老黄历)、佛历、道历,支持节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶等。lunar is a calendar library for Solar and Chinese Lunar.
http://6tail.cn/calendar/api.html
MIT License
691 stars 161 forks source link

1991-05-12 的日干支好像错了 #29

Closed sxwailyc closed 1 year ago

sxwailyc commented 1 year ago

1992-05-12,用我们的库得到的日干支是: 辛巳

一九九一年三月廿七 辛未(羊)年 癸巳(蛇)月 辛巳(蛇)日

但我查了其它好多地方,都是: 壬午

sxwailyc commented 1 year ago

发现

1991-05-12 00:00:00

这样就是错的

1991-05-12 01:00:00

这样就是对的

6tail commented 1 year ago
image

我测试是通过的,1991-05-12,为壬午。你这大概率是时区问题,从字符串转日期的吧?请参考: https://6tail.cn/calendar/api.html#faq.html

@Test public void test23(){ Solar solar = Solar.fromYmd(1991, 5, 12); Lunar lunar = solar.getLunar(); Assert.assertEquals("壬午", lunar.getDayInGanZhi()); }

sxwailyc commented 1 year ago

确实是这个原因,非常👍