-
Notifications
You must be signed in to change notification settings - Fork 82
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
"September" always incorrectly parsed as October #12
Comments
Also:
It looks like |
Hi @buzzert, I could not reproduce the reported error, it still happens? I figured it might be something related to the day you were testing or the timezone, but the result came out right anyway: w := when.New(nil)
w.Add(en.All...)
w.Add(common.All...)
PDTTimeZone, _ := time.LoadLocation("US/Pacific")
reference_date := time.Date(
2018, time.September, 1,
23, 41, 30, 0,
PDTTimeZone)
r, _ := w.Parse("September 5th", reference_date)
fmt.Println(r.Time.String())
r, _ = w.Parse("Sept. 5th", reference_date)
fmt.Println(r.Time.String())
r, _ = w.Parse("Sep 5", reference_date)
fmt.Println(r.Time.String())
r, _ = w.Parse("9/9/18", reference_date)
fmt.Println(r.Time.String()) Output: 2018-09-05 23:41:30 -0700 PDT
2018-09-05 23:41:30 -0700 PDT
2018-09-05 23:41:30 -0700 PDT
2018-09-09 23:41:30 -0700 PDT |
@gbaptista hmm it looks like this only reproduces if I use The last test makes even less sense.
Output:
|
I think I'm running into the same bug - February is parsing as March, and it's near the end of January. The problem is likely here: Line 17 in 59bd4ed
Why t is time.Now (Jan 30): Line 19 in 59bd4ed
then, the month is set: Lines 31 to 34 in 59bd4ed
This calls Then the day is applied: Lines 42 to 45 in 59bd4ed
This sets March 2 to March 11. |
Not sure why this is happening, but the following strings are yielding results that are a month off:
Correct:
The text was updated successfully, but these errors were encountered: