Sha256: fe31d59ed75169d7bd1b258408845e81a149fcb8c218d9d4e777477fe2424f74
Contents?: true
Size: 644 Bytes
Versions: 2
Compression:
Stored size: 644 Bytes
Contents
# frozen_string_literal: true require "datagrid/filters/ranged_filter" module Datagrid module Filters class DateTimeFilter < Datagrid::Filters::BaseFilter include Datagrid::Filters::RangedFilter def default_input_options { **super, type: "datetime-local" } end def parse(value) Datagrid::Utils.parse_datetime(value) end def format(value) if formats.any? && value value.strftime(formats.first) else super end end protected def formats Array(Datagrid.configuration.datetime_formats) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
datagrid-2.0.0 | lib/datagrid/filters/date_time_filter.rb |
datagrid-2.0.0.pre.alpha | lib/datagrid/filters/date_time_filter.rb |