Right now my application is spitting out:
Now Showing: 2012-01-07 – 2012-06-07
Which is pulled from a jQuery date picker that outputs the format in the same way. I want it to show up as “July 1, 2012 – July 6, 2012”
I’ve tried using the .strftime(“%b %d %y”) method but that hasn’t helped fix this.
In my application, a user selects a date range from the main page and that date is pushed into the model as report[params][:start_date] and report[params][:end_date]
Those dates are pushed into a mySQL query which is rendered in a Javascript Highchart on a reports/id page.
It’s a standard Rails app without anything fancy. My goal is to have the date show up as Month, Date, Year and this jQuery date selector is formatting it as Year-Day-Month. Not sure if I should change the date formatting in my application.js file or what I should do to resolve this.
Any help would be very much appreciated, thanks!
You’re using the wrong format for
.strftime. It should bejQuery UI’s Datepicker has a
dateFormatoption.There’s also a
$.datepicker.formatDate( format, date, settings )function to help with date formatting (should you choose to reformat the value of the input when the page loads via jQuery too).