https://github.com/zewebdev1337/leapyear
Determine if a year is a leap year.
https://github.com/zewebdev1337/leapyear
Last synced: 5 months ago
JSON representation
Determine if a year is a leap year.
- Host: GitHub
- URL: https://github.com/zewebdev1337/leapyear
- Owner: zewebdev1337
- License: mit
- Created: 2024-10-24T19:52:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-24T19:59:50.000Z (over 1 year ago)
- Last Synced: 2025-04-01T17:24:53.721Z (11 months ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/zewebdev1337/leapyear
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# leapyear
Provides a function to determine if a given year is a leap year.
## Constraints
A year is a leap year if:
- It is divisible by 4 AND
- It is NOT divisible by 100 OR it is divisible by 400
## Install
`go get github.com/zewebdev1337/leapyear`
## Usage
```go
import "leapyear"
year := 2024
isLeap := leapyear.Is(year) // returns true
```
## Examples
```
2024 -> true (divisible by 4)
2000 -> true (divisible by 400)
2100 -> false (divisible by 100 but not 400)
2023 -> false (not divisible by 4)
```
## License
MIT