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

Invalid date conversion! #15

Closed
sumanchapai opened this issue Mar 3, 2024 · 4 comments · Fixed by #16
Closed

Invalid date conversion! #15

sumanchapai opened this issue Mar 3, 2024 · 4 comments · Fixed by #16
Assignees
Labels
bug Something isn't working

Comments

@sumanchapai
Copy link
Collaborator

Run the following code

package main

import (
	"fmt"

	"github.com/opensource-nepal/go-nepali/dateConverter"
)

type AD struct {
	year  int
	month int
	day   int
}

func main() {
	ads := []AD{
		{2024, 6, 13},
		{2024, 6, 14},
	}
	for _, ad := range ads {
		bs, err := dateConverter.EnglishToNepali(ad.year, ad.month, ad.day)
		if err != nil {
			panic(err)
		}
		fmt.Printf("%v-%v-%v-AD\n", ad.year, ad.month, ad.day)
		fmt.Printf("%v-%v-%v-BS\n", bs[0], bs[1], bs[2])
		fmt.Printf("\n\n")
	}
}

and you'll get as output

2024-6-13-AD
2081-2-31-BS


2024-6-14-AD
2081-3-1-BS

Note that conversion of 2024-6-13-AD is correct while the next day is not! 2024-6-14-AD should be 2081-2-32-BS!

image
@aj3sh
Copy link
Member

aj3sh commented Mar 5, 2024

Hi @sumanchapai, thank you for reporting the bug! I've created a PR to address the current issue. However, we've encountered inconsistent month data on various Patros after the year 2081. We'll look into the matter promptly.

@sumanchapai
Copy link
Collaborator Author

Thanks. It's interesting to know that there's no consistency. If it helps, here's the data scraped from hamropatro for till: https://github.com/sumanchapai/patro/tree/main/data

@aj3sh
Copy link
Member

aj3sh commented Mar 5, 2024

I've noticed that Hamropatro has a total of 367 days in the year 2087, so I don't believe it has the correct data. I appreciate your help though.

@aj3sh aj3sh closed this as completed in #16 Mar 5, 2024
@aj3sh
Copy link
Member

aj3sh commented Mar 5, 2024

PR has been merged and created a new release with the tag v0.2.1.
https://pkg.go.dev/github.com/opensource-nepal/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants