Commit e84dad3f authored by Russ Cox's avatar Russ Cox

time: restore old error text for day out of range

Go 1.5 and earlier said "day out of range".
As part of working on this code it morphed into "day of month out of range".
To avoid churn in the output restore the old text.

This fixes some tests reported privately.

Change-Id: If179676cd49f9a471a9441fec2f5220c85eb0799
Reviewed-on: https://go-review.googlesource.com/18386Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 6b9298a2
......@@ -1002,7 +1002,7 @@ func parse(layout, value string, defaultLocation, local *Location) (Time, error)
// Validate the day of the month.
if day > daysIn(Month(month), year) {
return Time{}, &ParseError{alayout, avalue, "", value, ": day of month out of range"}
return Time{}, &ParseError{alayout, avalue, "", value, ": day out of range"}
}
if z != nil {
......
......@@ -233,13 +233,13 @@ func TestParseDayOutOfRange(t *testing.T) {
case test.ok && err == nil:
// OK
case !test.ok && err != nil:
if !strings.Contains(err.Error(), "day of month out of range") {
t.Errorf("%q: expected 'day of month' error, got %v", test.date, err)
if !strings.Contains(err.Error(), "day out of range") {
t.Errorf("%q: expected 'day' error, got %v", test.date, err)
}
case test.ok && err != nil:
t.Errorf("%q: unexpected error: %v", test.date, err)
case !test.ok && err == nil:
t.Errorf("%q: expected 'day of month' error, got none", test.date)
t.Errorf("%q: expected 'day' error, got none", test.date)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment