6tail / lunar-java

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

二十四节气日期在2021年计算有误 #5

Closed helloblack2017 closed 3 years ago

helloblack2017 commented 3 years ago

2021年冬至对应国历是12月21日;

根据一下代码计算是

package com.nlf.calendar.lunar;

import cn.hutool.core.date.ChineseDate;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import com.nlf.calendar.Lunar;
import com.nlf.calendar.Solar;
import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

public class LunarTest {
    @Test
    public void testGetJieQiTable() throws ParseException {
        SimpleDateFormat stringToDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = stringToDateFormat.parse("2022-12-25 00:00:00");
        Lunar lunar = new Lunar(date);
        Map<String,Solar> jieQiTable = lunar.getJieQiTable();
        Console.log(jieQiTable);
    }
}

运行结果:

{冬至=2021-12-22, 小寒=2022-01-05, 大寒=2022-01-20, 立春=2022-02-04, 雨水=2022-02-19, 惊蛰=2022-03-05, 春分=2022-03-20, 清明=2022-04-05, 谷雨=2022-04-20, 立夏=2022-05-05, 小满=2022-05-21, 芒种=2022-06-06, 夏至=2022-06-21, 小暑=2022-07-07, 大暑=2022-07-23, 立秋=2022-08-07, 处暑=2022-08-23, 白露=2022-09-07, 秋分=2022-09-23, 寒露=2022-10-08, 霜降=2022-10-23, 立冬=2022-11-07, 小雪=2022-11-22, 大雪=2022-12-07}
6tail commented 3 years ago

嗯,节气算法误差造成的,21号23:59的冬至,因误差算出来是22号0点了,看来节气的精度问题还是要处理。

6tail commented 3 years ago

@helloblack2017 谢谢你提出的问题,已参考最新寿星天文历算法修复了节气误差。

helloblack2017 commented 3 years ago

🐂 厉害,迅速

6tail notifications@github.com 于2020年7月15日周三 下午4:58写道:

@helloblack2017 https://github.com/helloblack2017 谢谢你提出的问题,已参考最新寿星天文历算法修复了节气误差。

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/6tail/lunar-java/issues/5#issuecomment-658641115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7FZAYK4URDEC4JZ5ZRD5DR3VVSRANCNFSM4O2DIZNQ .