Reputation: 12653
I have a :date_as_text
field in a Rails form. When the form is submitted this field is parsed by Chronic and a datetime saved to the database.
As this is a text field, the user can type a variety of different date formats, or even 'today', 'yesterday', etc and all (most) are interpreted by Chronic.
Input values can also be set via a jquery datepicker attached to the field.
If the user types an entry that corresponds exactly to the date format expected by datepicker (in this case yy-MM-dd), then the datepicker is updated to display the currently selected data.
How can I parse the entered value on the client side so that the datepicker will also recognize other date formats? I'm struggling to conceptualize how to even approach this.
Does this sound feasible, or is a Really Bad Idea? Appreciate thoughts or experience from others.
Upvotes: 0
Views: 135