Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add time constants for Day, Week, Month, and Year #609

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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.

None yet

3 participants