Previously, to exclude seconds from datetime, we had to parse datetime using strftime.

##### Before

Let’s say we have a Product model and we need to show purchased_at as a date time field excluding seconds.

This is our ProductsController.

And this is how our views/products/show.html.erb would look like.

And this is how it will get rendered on the browser.

#### After

Now, Rails allows adding a include_seconds option to datetime_field, using which we can include/exclude the seconds.

This is how a browser renders it.

And suppose we need to include the seconds, we can pass include_seconds as true.

Check out the PR for more details.