New Release of UJS Date-Picker Rails Plugin

Saturday, March 8th, 2008 @ 10:53 pm | Ruby, Web Development

I’ve now updated my date-picker Rails plugin based on Brian McAllister’s Unobtrusive Date-Picker Widget. It now includes helper methods for making selects that wrap a ActiveRecord model object, or just a date/time value. It also includes many more options, mostly offering pragmatic ways of adding the options available to controlling the date-picker widget through html classes.

I’ve also created a large number of specs (with RSpec) for testing the plugin. Amazingly, testing plugins is actually really hard task, which I’ll probablly cover in a future post.

I’ve created a wiki page for Documentation and updated the RDoc’s.

If your using the plugin, and have any questions or concerns, or bug reports feel free to contact me.

Tags: , , , ,

2 Responses to “New Release of UJS Date-Picker Rails Plugin”

  1. Steve Says:

    Hello Brian; I’m sure I’m being completely clueless here but… I think I followed the instructions. :( First, I wasn’t getting the calendar, or anything but the basic html select form widgets. It seems the stylesheet thinks the graphic assets are in a directory called “media” when in fact they are in images/datepicker

    I made that change and now that part works. Cool!

    But… When I clicked the submit button to save a new record I got the following error:

    NoMethodError in AssignmentsController#create undefined method `to_i’ for {”hour”=>”9″}:HashWithIndifferentAccess

    (In this little test my model is named Assignment. I made the test project with the basic 2.0.2 scaffold, and defined the table data type as datetime. Was that the right thing to have done? I have it set to distinguish between AM and PM, and I tried to save a new Assignment for May 30, 2008 at 9:00 AM. It seems to have trouble with the hour.)

    Thanks for your help, and thanks for this great plugin!

    I’ve got another question not specifically related to your plugin. I can’t figure out how to work with time separate from date. The project I hope to use this for will be aimed at managing bookings for the photo studio I work for. When booking a new assignment we will need to record the day, month and year obviously. And a start time (hour and minute). But ideally I’d also like to be able to define an end time. Most of our jobs don’t span multiple days, so the only thing I need to record for the end time is… the time, since the date is the same. Do you have any tips for how to save only the time for this bit (excluding the date)? There is a Date object that doesn’t hold any time data, but seemingly no corresponding Time object that doesn’t have a reference to date info. And it seems that even if you only display the time part, somehow some default date data gets saved with the time data which could really mess things up down the road. Or maybe I’m just not grasping some obvious basic concept.

    Anyway - thanks again!

    Steve

  2. Brian Says:

    Steve, this issue has now been fixed.

    Thanks for helping report the issue, and thanks for using the plugin!

Leave a Reply