overtrue / chinese-calendar

:date: 中国农历(阴历)与阳历(公历)转换与查询工具
MIT License
522 stars 109 forks source link

中国实行夏令时期间农历计算错误 #52

Open kamiiroawase opened 1 year ago

kamiiroawase commented 1 year ago

// 这里输出 26 echo (new Overtrue\ChineseCalendar\Calendar())->solar2lunar(1986, 5, 4)['lunar_day'];

// 这里还是输出 26 echo (new Overtrue\ChineseCalendar\Calendar())->solar2lunar(1986, 5, 5)['lunar_day'];

大佬能不能处理一下,很急,不弄好老板要开除我

overtrue commented 1 year ago

抱歉没能复现,我的代码如下:

<?php

require __DIR__ . '/vendor/autoload.php';

use Overtrue\ChineseCalendar\Calendar;

date_default_timezone_set('PRC');

$calendar = new Calendar();

var_dump($calendar->solar2lunar(1986, 5, 4)['lunar_day']);
var_dump($calendar->solar2lunar(1986, 5, 5)['lunar_day']);

输出结果:

$ php index.php
string(2) "26"
string(2) "27"
overtrue commented 1 year ago

PHP 什么版本?

kamiiroawase commented 1 year ago

8.0.27

kamiiroawase commented 1 year ago

我试过了用 php 8.2 结果是正确的,php 8.0.27 是错误的

overtrue commented 1 year ago

试了一下 PHP 8.1 就正确了,应该是哪里有 Bug,我找找

kamiiroawase commented 1 year ago

可能是这个bug https://bugs.php.net/bug.php?id=80664 php 8.1 已经修复了

kamiiroawase commented 1 year ago

大佬看看有没有办法兼容旧版本 php 可以的话我们就不用更新 php 版本了