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

Introduce Date#all_day #24930

Merged
merged 1 commit into from May 16, 2016

Conversation

Projects
None yet
7 participants
@henrik
Contributor

henrik commented May 9, 2016

Useful for queries like:

Item.where(created_at: Date.current.all_day)

There was already a Time#all_day with the same behaviour, so you can already do

Item.where(created_at: Date.current.to_time.all_day)

but arguably having the method on Date as well makes it both read better, and more convenient to write.

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot May 9, 2016

r? @senny

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented May 9, 2016

r? @senny

(@rails-bot has picked a reviewer for you, use r? to override)

@henrik

View changes

Show outdated Hide outdated activesupport/lib/active_support/core_ext/date/calculations.rb Outdated
@egilburg

This comment has been minimized.

Show comment
Hide comment
@egilburg

egilburg May 9, 2016

Contributor

Wouldn't it make more sense to use just Date.current and have the ORM convert it to the DateTime range clause if used on a Datetime column?

Contributor

egilburg commented May 9, 2016

Wouldn't it make more sense to use just Date.current and have the ORM convert it to the DateTime range clause if used on a Datetime column?

@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik May 9, 2016

Contributor

Oops, will look into the CI failures.

@egilburg Hm, possibly. I don't mind the explicitness of the all_day (indeed, I kind of like it), and I like the symmetry with all_week and friends. And that it makes all_day shared between Date and Time like those other methods.

Contributor

henrik commented May 9, 2016

Oops, will look into the CI failures.

@egilburg Hm, possibly. I don't mind the explicitness of the all_day (indeed, I kind of like it), and I like the symmetry with all_week and friends. And that it makes all_day shared between Date and Time like those other methods.

Introduce Date#all_day
Useful for queries like:

    Item.where(created_at: Date.current.all_day)

There was already a Time#all_day with the same behaviour, but for
queries like the above, Date is more convenient.
@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik May 11, 2016

Contributor

Seems Senny might be unavailable – let's try this:

r?

Contributor

henrik commented May 11, 2016

Seems Senny might be unavailable – let's try this:

r?

@senny

This comment has been minimized.

Show comment
Hide comment
@senny

senny May 12, 2016

Member

r? @pixeltrix might be able to help out.

Member

senny commented May 12, 2016

r? @pixeltrix might be able to help out.

@rails-bot rails-bot assigned pixeltrix and unassigned senny May 12, 2016

@sgrif sgrif merged commit 3d4e712 into rails:master May 16, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik May 16, 2016

Contributor

@sgrif Thank you, appreciate it!

Contributor

henrik commented May 16, 2016

@sgrif Thank you, appreciate it!

@henrik henrik deleted the henrik:date-all-day branch May 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment