GithubHelp home page GithubHelp logo

Comments (17)

caoyanglee avatar caoyanglee commented on June 10, 2024 1

这个问题又出现了! @6tail
1946年9月30号 => 九月初五,实际上是九月初六才对。往前的日子都一样,按农历来算都是少一天!
版本:[v1.2.14]
然后老版本[v1.2.0]是没有这个问题的!

dart版本完全没问题,版本:1.2.12

from lunar-java.

6tail avatar 6tail commented on June 10, 2024 1

from lunar-java.

6tail avatar 6tail commented on June 10, 2024 1

from lunar-java.

6tail avatar 6tail commented on June 10, 2024

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

image
难道是站长工具的问题 - -

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

我的提问里时间戳粘贴错了..稍等 我修改下

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

取了我现在的时间戳: 1639473146000 初始化后打印出农历: 二〇二一年冬月十一 ,这个是正确的
时间戳替换成: 681231600000 初始化后打印出农历: 一九九一年六月廿三, 这个是错误的,正确的应该一九九一年六月廿四

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

所以这个时间戳681231600000 应该是8月4号

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

应该是夏令时的问题?

from lunar-java.

6tail avatar 6tail commented on June 10, 2024

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

应该是夏令时的问题,不过我感觉有点晕.在苹果上用苹果自带的库转过,是8.4号

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

你好,dart 我使用的是1.2.12版本,java是1.2.13的jar文件版本,我复制了你的dart test来执行,得到的结果跟你的不同.
image

image

很奇怪..

from lunar-java.

BadReese avatar BadReese commented on June 10, 2024

Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "macos_x64"

from lunar-java.

caoyanglee avatar caoyanglee commented on June 10, 2024

@6tail fromYmd确实没问题,但是fromCalendar和fromDate就有问题了

下面是单元测试

//1946年9月30号
@Test
fun test1() {
    val calendar = Calendar.getInstance().apply {
        this.set(Calendar.YEAR,1946)
        this.set(Calendar.MONTH,8)//9月
        this.set(Calendar.DAY_OF_MONTH,30)
        this.set(Calendar.HOUR_OF_DAY, 0)
        this.set(Calendar.MINUTE, 0)
        this.set(Calendar.SECOND, 0)
        this.set(Calendar.MILLISECOND, 0)
    }
    val solar = Solar.fromCalendar(calendar)
    val lunar = solar.lunar
    Assert.assertEquals("一九四六年九月初六", lunar.toString())
}

//1946年9月29号
@Test
fun test2() {
    val calendar = Calendar.getInstance().apply {
        this.set(Calendar.YEAR,1946)
        this.set(Calendar.MONTH,8)//9月
        this.set(Calendar.DAY_OF_MONTH,29)
        this.set(Calendar.HOUR_OF_DAY, 0)
        this.set(Calendar.MINUTE, 0)
        this.set(Calendar.SECOND, 0)
        this.set(Calendar.MILLISECOND, 0)
    }
    val solar = Solar.fromCalendar(calendar)
    val lunar = solar.lunar
    Assert.assertEquals("一九四六年九月初五", lunar.toString())
}

from lunar-java.

caoyanglee avatar caoyanglee commented on June 10, 2024

@6tail 你说的设置时区是App里还是手机里的,我刚试了一下你的单元测试,依然是有问题的

from lunar-java.

caoyanglee avatar caoyanglee commented on June 10, 2024

@6tail 我现在先把Calendar和Date转Solar然后在转Lunar就没问题了。但是这样子,Lunar.fromDate和Lunar.fromCalendar就不能用了~

from lunar-java.

6tail avatar 6tail commented on June 10, 2024

from lunar-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.