---
title: "dromara/carbon: minute boundaries across DST in Go | VulCode"
description: "A fix to dromara/carbon, a Go time package: StartOfMinute and EndOfMinute keep the instant, zone and offset in the hour that repeats when the clocks go back."
url: "https://vulcode.com/en/opensource/contributions/dromara-carbon"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

dromara/carbon

# dromara/carbon

A Go package for dates and times with a simple, readable API, with helpers such as the start and end of a minute, a day or a century.

[See the repository](https://github.com/dromara/carbon) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Go
- **GitHub stars**: 5,225
- **Merged changes**: 1
- **Project site**: [dromara.org](https://dromara.org/carbon/)

## What we changed

StartOfMinute and EndOfMinute keep the same instant, location and offset, also in the hour that repeats when the clocks go back.

### What this work shows

- Time zones and DST transitions

- Go's time package

- LMT offsets with seconds

What was broken

### A minute that ended before its own instant

StartOfMinute and EndOfMinute rebuilt the time with time.Date from the year, month, day, hour and minute. In the hour that repeats when the clocks go back, 01:34:49 EST in New York got a minute that ended before that instant.

How we fixed it

### Seconds subtracted from the existing instant

Both functions now copy the instance and subtract the local seconds and nanoseconds, so they keep the instant, location and offset. We avoided Truncate(time.Minute), which breaks LMT offsets with seconds, and tests cover New York, Lord Howe and Monrovia from the time of such an offset.

[#378](https://github.com/dromara/carbon/pull/378)

## Merged change 1

- [#378 fix(boundary): preserve instants at minute boundaries Merged 10 October 2026](https://github.com/dromara/carbon/pull/378)

## What it taught us

Rebuilding a time from its parts loses which of two repeated hours was meant. It is safer to subtract the seconds from the existing instant and test it on zones with unusual offsets.

[More about this technology: Golang](https://vulcode.com/en/technologies/go)

## Other projects we write code for

- [**urfave/cli** Go · 24,329 stars A declarative Go package for building command line tools.](https://vulcode.com/en/opensource/contributions/urfave-cli)

- [**chezmoi** Go · 22,342 stars A dotfiles manager that keeps the same settings on many different machines, securely.](https://vulcode.com/en/opensource/contributions/chezmoi)

- [**goquery** Go · 14,995 stars A Go library for traversing and changing HTML documents in the style of jQuery, built on the golang.org/x/net/html parser.](https://vulcode.com/en/opensource/contributions/goquery)

- [**Ebitengine** Go · 13,647 stars A 2D game engine in Go, used in games released for computers, phones, browsers and consoles.](https://vulcode.com/en/opensource/contributions/ebiten)

- [**Fission** Go · 8,950 stars A serverless functions framework for Kubernetes that runs code as functions and scales them down to zero when they are idle.](https://vulcode.com/en/opensource/contributions/fission)

- [**Concourse** Go · 7,944 stars A container-based automation system written in Go and used mostly for CI/CD. Pipelines and tasks are described in YAML files.](https://vulcode.com/en/opensource/contributions/concourse)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
