Class: Administrate::Field::DateTime

Inherits:
Base
  • Object
show all
Defined in:
lib/administrate/field/date_time.rb

Instance Attribute Summary

Attributes inherited from Base

#attribute, #data, #page, #resource

Instance Method Summary collapse

Methods inherited from Base

#html_class, html_class, #initialize, #name, permitted_attribute, searchable?, #to_partial_path, with_options

Constructor Details

This class inherits a constructor from Administrate::Field::Base

Instance Method Details

#dateObject



6
7
8
9
10
11
# File 'lib/administrate/field/date_time.rb', line 6

def date
  I18n.localize(
    data.in_time_zone(timezone).to_date,
    format: format,
  )
end

#datetimeObject



13
14
15
16
17
18
19
# File 'lib/administrate/field/date_time.rb', line 13

def datetime
  I18n.localize(
    data.in_time_zone(timezone),
    format: format,
    default: data,
  )
end