
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Have a datetime attribute? Want to have a datepicker for the date and dropdown menus for the time? This gem adds the necessary accessors to your model.
In your Gemfile
:
gem "split_datetime"
After bundling, assuming you have an Event model with a starts_at attribute, add this to your model:
class Event < ActiveRecord::Base
extend SplitDatetime::Accessors
accepts_split_datetime_for :starts_at
end
In your view:
<%= simple_form_for @event do |f| %>
<%= f.input :starts_at_date, as: :string, input_html: { class: 'datepicker' } %>
<%= f.input :starts_at_hour, collection: 0..24 %>
<%= f.input :starts_at_min, collection: [0, 15, 30, 45] %>
<%= ... %>
<% end %>
Add your js datepicker and you're good to go. (Of course, this also works with standard rails form helpers).
starts_at
will be Time.now with the minute set to 0 by default. If you want to change this, pass in a lambda wrapping the default. E.g.:
accepts_split_datetime_for :starts_at, default: lambda { Time.now.change(min: 0) + 2.weeks }
accepts_split_datetime_for :starts_at, default: lambda { Time.now }
You can also specify the date format for the view:
accepts_split_datetime_for :starts_at, format: "%D"
See Time#strftime
for formats. Default is "%F"
.
FAQs
Unknown package
We found that split_datetime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.