-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Off-by-One in lunar date calculation #83
Comments
What is your current time zone?you can try |
I'm currently in the time zone of Berlin (GMT+02:00), but using However, I tried London as well, just to see if it changes anything, and here it converts it correctly [2]. [1]:func main() {
lunarDate := carbon.Parse("2021-06-14", carbon.{Berlin, Tokyo, PRC}).Lunar()
festival := lunarDate.Festival()
fmt.Printf("Lunar Date: %d-%d-%d\n", lunarDate.Year(), lunarDate.Month(), lunarDate.Day())
fmt.Printf("Festival: %s\n", festival)
} Output:
[2]:func main() {
lunarDate := carbon.Parse("2021-06-14", carbon.London).Lunar()
festival := lunarDate.Festival()
fmt.Printf("Lunar Date: %d-%d-%d\n", lunarDate.Year(), lunarDate.Month(), lunarDate.Day())
fmt.Printf("Festival: %s\n", festival)
} Output:
|
Thank you very much.I found the reason for the bug because |
Fixed in v1.5.0 |
Hello,
I encountered an issue with the following code:
carbon version:
v1.4.6
golang version:
go version go1.16.6 linux/amd64
I expected to get (in
yyyy-mm-dd
format):But I actually get:
Thanks!
Additional info:
I encountered this issue when I was working on a test for a pull request.
The festival tests in
calendar.lunar_test.go:52
always fail because the date is off-by-one, causing the program to find empty festivals for a correct date.I tried fixing the issue myself but I'm simply not versed enough in Chinese dates to do so.
Here's also an example illustrating this error while using the library itself (opposed to the testing environment)
Command:
Output:
The text was updated successfully, but these errors were encountered: