Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifying date picker_pattern breaks field input #55

Open
msands opened this issue Mar 14, 2017 · 2 comments
Open

modifying date picker_pattern breaks field input #55

msands opened this issue Mar 14, 2017 · 2 comments

Comments

@msands
Copy link

msands commented Mar 14, 2017

Good evening, first of all, thanks for a great gem.

First of all, let me start this out by saying I had to modify the files a little to properly reflect how the gem should inherit from each other. I had to do this because there was no way to properly change the date icon separately from the time icon. In it's current form, modifying the icon would change it for both the date AND the time. So, my current file structure is as follows:

https://gist.github.com/msands/c154549cb5f311ec096604f3f22904c9

Now, when attempting to change

  def picker_pattern
    I18n.t('datepicker.pformat', default: 'DD/MM/YYYY')
  end

to

  def picker_pattern
    I18n.t('datepicker.pformat', default: 'MM/DD/YYYY')
  end

any submission of the form stores nil in the database for rails on the date field. Here is my form input in simple_form:
= e.input :date, as: :date_picker, label: "Event date", required: true

If I modify the display_patern to the US display of %m/%d/%Y, and leave the picker_patern how it is, everything gets sent to the database correctly. This ONLY breaks when modifying picker_patern.

@msands
Copy link
Author

msands commented Mar 14, 2017

OK, I think I may have figured out the problem.

This block of code

  def date_options
    date_options_base
  end

HAS to be located in the file that has the datepicker.pformat information.

@msands msands closed this as completed Mar 14, 2017
@msands msands reopened this Mar 14, 2017
@msands
Copy link
Author

msands commented Mar 14, 2017

Apparently I was wrong. that simple addition does not fix the formatting issue on the displaying of the date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant