Skip to content

Milliseconds and microseconds formatting regression in carbon v2.6 #328

@CaptainWalletCedricPerotto

Description

Hello,

After upgrading form v2.5.2 to 2.6.15, I encountered an issue with the following code:

inputTime := time.Date(2026, 1, 22, 11, 30, 52, 624_225_666, time.UTC)
c := carbon.CreateFromStdTime(inputTime)
fmt.Println(c.Format("Y-m-d H:i:s.v"))
fmt.Println(inputTime.Format("2006-01-02 15:04:05.999"))
fmt.Println(c.Format("Y-m-d H:i:s.u"))
fmt.Println(inputTime.Format("2006-01-02 15:04:05.999999"))

golang version: 1.25.0

carbon version: v2.6.15

time zone: *Europe/Paris (tests in UTC)

I expected to get:

2026-01-22 11:30:52.624
2026-01-22 11:30:52.624
2026-01-22 11:30:52.624225
2026-01-22 11:30:52.624225

But I actually get:

2026-01-22 11:30:52.624
2026-01-22 11:30:52.999999
2026-01-22 11:30:52.624225
2026-01-22 11:30:52.999

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReport a reproducible bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions