Skip to content

Commit 9187e3d

Browse files
wjhuang2016qw4990
authored andcommitted
Fix last_day function (#9746)
1 parent 0618339 commit 9187e3d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

expression/builtin_time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5641,7 +5641,7 @@ func (b *builtinLastDaySig) evalTime(row chunk.Row) (types.Time, bool, error) {
56415641
tm := arg.Time
56425642
var day int
56435643
year, month := tm.Year(), tm.Month()
5644-
if year == 0 && month == 0 && tm.Day() == 0 {
5644+
if month == 0 {
56455645
return types.Time{}, true, handleInvalidTimeError(b.ctx, types.ErrIncorrectDatetimeValue.GenWithStackByArgs(arg.String()))
56465646
}
56475647
day = types.GetLastDay(year, month)

expression/builtin_time_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,6 +2428,8 @@ func (s *testEvaluatorSuite) TestLastDay(c *C) {
24282428
"0000-00-00",
24292429
"1992-13-00",
24302430
"2007-10-07 23:59:61",
2431+
"2005-00-00",
2432+
"2005-00-01",
24312433
123456789}
24322434

24332435
for _, i := range testsNull {

0 commit comments

Comments
 (0)