Skip to content

Conversation

@liorkesten
Copy link

PR Description

Added time constants for Day, Week, Month, and Year to ensure consistency and simplify access, avoiding inline calculations like 24 * time.Hour.

@liorkesten liorkesten closed this Mar 9, 2025
@liorkesten liorkesten reopened this Mar 9, 2025
@liorkesten liorkesten changed the title feat: Added time constants feat: Add time constants for Day, Week, Month, and Year Mar 9, 2025
@samber
Copy link
Owner

samber commented Mar 16, 2025

hey @liorkesten

There is a good reason if go does not bring those constants already.

1 day is not always 24 hours
1 month is not always 30 days
1 year is not always 365 days

The stdlib comes with t.AddDate(...), but i think there are some libraries for accurate computations.

Feel free to argue until I close the PR.

@senago
Copy link
Contributor

senago commented Mar 17, 2025

There's a pretty cool list of common falsehoods about time: https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca

@samber samber closed this Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants