8000 GitHub - andrerferrer/nice-date-demo
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

andrerferrer/nice-date-demo

Repository files navigation

GOAL

This is a demo to show-case how to implement an easy date picker in rails using the simple form gem.

You can also check my other demos.

TLDR

<%= f.input :a_date, as: :date, html5: true %>
<%= f.input :a_date, as: :datetime, html5: true %>

What needs to be done?

  • have a model with the date / date-time

eg.: rails g model booking restaurant:references booked_at:datetime

  • create the form:
  <h2>Create a new booking</h2>
  <%= simple_form_for Booking.new do |f| %>
    <%= f.input :booked_at, as: :datetime, html5: true %>

    <%# It would work as date as well! %>
    <%# f.input :booked_at, as: :date, html5: true %>
    
    <%= f.association :restaurant %>
    <%= f.submit %>
  <% end %>

And we're good to go

Good Luck 🍀 and Have Fun 🤓

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0