Sha256: 44c445bc35fcf557fc5347e28feb3d5c73cf9598c10d6cc75c2cad6b052a8f02
Contents?: true
Size: 538 Bytes
Versions: 2
Compression:
Stored size: 538 Bytes
Contents
class DateTimeComponent < BaseComponent def index date = super date.to_s(field.options[:format].presence || :db) if date.present? end def form @format = time_format render end def filter @format = time_format render end private def time_format @format ||= case field.type when :date then '%Y-%m-%d' when :time then '%H:%M:%S' when :datetime, :date_time, :timestamp then '%Y-%m-%d %H:%M:%S' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.1.1 | app/components/date_time_component.rb |
puffer-0.1.0 | app/components/date_time_component.rb |