Skip to content

Date field gets deleted, is detected as datetime #3134

Closed
@sedubois

Description

@sedubois

Rails admin half of the time displays and allows to select a time, even for fields of type date and not datetime. This is what it sometimes shows (correct):

Screenshot 2019-05-10 at 11 51 53

But just when reloading the page, sometimes it shows this, apparently randomly:

Screenshot 2019-05-10 at 11 52 02

The same display issue applies to the edit page.

But more importantly, when editing the record, randomly the date gets deleted upon saving. So because of this, any time I edit a record, I need to go and check if the date was preserved, otherwise I need to go and enter it again (hoping I remember what the value was).

Using rails_admin 1.4.2 and DB schema:

  create_table "testimonials", force: :cascade do |t|
    ....
    t.date     "date"
  end

EDIT: the issue remains (and even gets worse) if the type is set explicitly in the config:

  config.model 'Testimonial' do
    list do
      ...
      field :date, :date
    end
  end

Even in that case the time is shown:

Screenshot 2019-05-10 at 11 44 33

But more importantly, in this case the date field then gets silently nullified every single time when the record is edited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions