-
Notifications
You must be signed in to change notification settings - Fork 27
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
fixes #28 where making time struct with New() function did not counted leap year logic #31
Conversation
@abtinokhovat Thank you for fixing the issue. Could you please add some unit tests for it as well? |
Yep, of course, I will add some unit tests in near future. |
@abtinokhovat & @yaa110, |
I'm now adding some documentation to the mathematic formula's I've used here and I will also add some tests here. |
@seyedmmousavi @yaa110 I've added documentation as best as I could. The formula is somewhat ambiguous, and the result is based on my work on calendars from various sources over the years. I've included them as I remembered and had them. It is legacy code that I originally wrote in TypeScript and then rewrote in Go. I also added detailed test cases for each conversion function, both forward and backward. |
fixes #28 |
New(time) function was not calculating correctly on days which were leap days or in leap years
`tl := time.Date(2025, 3, 20, 0, 0, 0, 0, time.Local)
ti2 := New(tl)
fmt.Println(ti2.Format("yyyy-MM-dd"))
`
for example these days are the same how ever the calculation had errors both have to be
1403-12-30
but the one withptime
package is1404-01-01
also this fixes this issue.