Skip to content

Commit e84dad3

Browse files
committed
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/18386 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 6b9298a commit e84dad3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/time/format.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ func parse(layout, value string, defaultLocation, local *Location) (Time, error)
10021002

10031003
// Validate the day of the month.
10041004
if day > daysIn(Month(month), year) {
1005-
return Time{}, &ParseError{alayout, avalue, "", value, ": day of month out of range"}
1005+
return Time{}, &ParseError{alayout, avalue, "", value, ": day out of range"}
10061006
}
10071007

10081008
if z != nil {

src/time/format_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ func TestParseDayOutOfRange(t *testing.T) {
233233
case test.ok && err == nil:
234234
// OK
235235
case !test.ok && err != nil:
236-
if !strings.Contains(err.Error(), "day of month out of range") {
237-
t.Errorf("%q: expected 'day of month' error, got %v", test.date, err)
236+
if !strings.Contains(err.Error(), "day out of range") {
237+
t.Errorf("%q: expected 'day' error, got %v", test.date, err)
238238
}
239239
case test.ok && err != nil:
240240
t.Errorf("%q: unexpected error: %v", test.date, err)
241241
case !test.ok && err == nil:
242-
t.Errorf("%q: expected 'day of month' error, got none", test.date)
242+
t.Errorf("%q: expected 'day' error, got none", test.date)
243243
}
244244
}
245245
}

0 commit comments

Comments
 (0)