administrate: Invalid date error

I have a Post model with these attributes:

create_table :posts do |t|
      t.date :date
      t.text :rationale

      t.timestamps
end

date field is of type ‘date’ (Postgresql database) After entering /admin/posts I get an error:

Showing /home/jedrek/.rvm/gems/ruby-2.3.0/gems/administrate-0.8.1/app/views/fields/date_time/_index.html.erb where line #20 raised:

invalid date

  #   "12/13/2012".to_date # => ArgumentError: invalid date
  def to_date
    ::Date.parse(self, false) unless blank?
  end

  # Converts a string to a DateTime value.

gem ‘administrate’, ‘~> 0.8.1’ Rails 5.0.5

I know for sure that it worked fine in gem “administrate”, “~> 0.2.2”

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18

Most upvoted comments

Click ‘Watch’ on top to stay up-to-date with the thread. It’s about the issue you have.

12.02.2018 5:21 AM “Izak T” notifications@github.com napisał(a):

I’m confused about what you suggested me to watch. could you please be more specific?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thoughtbot/administrate/issues/1029#issuecomment-364825605, or mute the thread https://github.com/notifications/unsubscribe-auth/AFo1ibZMJbIbv-yFyrwgMtV4SFL4spULks5tT7w5gaJpZM4Ql8zl .

When does your problem occur? When you try to search for something by particular data type? I.e. you search by date ‘2017-12-30’? Or by employee name? If yes, then you should raise and issue with the gem. It does not work for me either.

Would love to know what that typo was because I have the same exact problem.