The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
iseki

之前写的, JSR-310 风格的时间日期库, 1.0 了

  •  
  •   iseki ·
    iseki0 · Dec 17, 2025 · 2074 views
    This topic created in 233 days ago, the information mentioned may be changed or developed.

    整体遵守 JSR-310 风格,针对 Go 的语法特点做了必要的适配。

    所有的变更操作采用链式调用,被折叠的链式调用错误会增加必要的诊断信息,以便快速找到具体失败的操作位置,比如:

    result, err := dt.Chain().PlusMonths(1).WithDayOfMonth(32).GetResult()
    // 错误文本 "goda: invalid value of DayOfMonth...: 32 at LocalDate/WithDayOfMonth"
    

    目前还缺乏的功能,接下来会加上的功能:

    • ZonedDateTime;
    • 基于 Temporal 的加减运算;
    • Duration/Period;

    项目: https://github.com/iseki0/goda

    iseki
        1
    iseki  
    OP
       Dec 17, 2025 via Android
    时间有效表达范围:-2^48~2^48-1 年,精度纳秒,足以装下 time/Time 的表达范围,但这超出了 int64 可表达的 UNIX 时间戳范围,超出范围的情况可以通过 TemporalValue 的 overflow 探测到。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2857 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 11:03 · PVG 19:03 · LAX 04:03 · JFK 07:03
    ♥ Do have faith in what you're doing.