Skip to content
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

implement last_days() #2460

Merged
merged 6 commits into from
Apr 16, 2024
Merged

implement last_days() #2460

merged 6 commits into from
Apr 16, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Apr 16, 2024

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -232,3 +232,82 @@ func (f *FromDays) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
months, days := daysToMonth(years, days)
return time.Date(int(years), time.Month(months), int(days), 0, 0, 0, 0, time.UTC), nil
}

// LastDay is a function that the date but at the last day of the month.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// LastDay is a function that the date but at the last day of the month.
// LastDay is a function that returns the date at the last day of the month.

arg: expression.NewLiteral("0001-11-00", types.Text),
exp: time.Date(1, 11, 30, 0, 0, 0, 0, time.UTC),
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) might be worth adding another date that has an incorrect day for the month, like 2020-02-30 or something.

@jycor jycor merged commit 509c423 into main Apr 16, 2024
7 checks passed
@jycor jycor deleted the james/days branch April 16, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants