opensource-nepal / go-nepali

go-nepali is a go package containing features that will be useful for Nepali projects.
GNU General Public License v3.0
7 stars 5 forks source link

fix(parser): fixed error messages for parsing #21

Closed aj3sh closed 7 months ago

aj3sh commented 7 months ago

While parsing the datetime string, it shows the wrong message in some cases. This PR fixes the error message.

Case 1: Out of Range Date

npTime, err := nepalitime.Parse("1800-01-01", "%Y-%m-%d")
# Output: datetime string did not match with given format
# Expected: date is out of range

Case 2: Datetime string without year

npTime, err := nepalitime.Parse("01-01 %k", "%m-%d %%k");
# Output: datetime string did not match with given format
# Expected: unable to parse year
aj3sh commented 7 months ago

Ignore build codecov/patch