Sha256: 2306f1a2924622d7d193fc8d9886d58ce41e2c1ee652cb39e8da45f7fa086a30
Contents?: true
Size: 523 Bytes
Versions: 16
Compression:
Stored size: 523 Bytes
Contents
module Formstrap class FlatpickrView < ViewModel def options keys = attributes - %i[data] options = to_h.slice(*keys) default_options.deep_merge(options) end private def default_options { data: default_data.deep_merge(data || {}) } end def default_data { controller: "flatpickr", flatpickr: { defaultDate: attribute.nil? ? Date.today : form.object&.send(attribute)&.strftime("%d/%m/%Y") } } end end end
Version data entries
16 entries across 16 versions & 1 rubygems