timely plugin

«

»

One of the things I've needed to do at work is provide a date/time picker for events. The datetime select stuff that's built-in to Rails is pretty pathetic in terms of UI. It gets the job done, but it definitely gives the impression of scaffolding rather than the kind of polish that belongs in a final product.

There's a neat-looking javascript calendar entry widget called Datebocks that provides a nicer interface. It was packaged into a Rails plugin by Corey Donohoe, but his plugin was for dates only rather than dates and time. I made some modifications to it so it works with datetime as well. You should be able to just use it as a drop-in replacement after installing the plugin and running rake calendar:assets:install.

Note that by default Datebocks allows you to choose from a number of date formats popular in different locales. The default is ISO format: yyyy-mm-dd HH: MM, but if you poke at the javascript, you can adjust this. There is currently no way to adjust this on the Ruby side of things, and my time additions only affect the default date format. There is some really ugly logic in the JS that discouraged me from doing a complete fix, but it's really not much work to adjust if you need another date format. But really: ISO date format should keep everyone happy; it's something fairly easy to agree upon.

And because it always helps to have a sample:

  • Calendar
  • Help

In closing, I link to Pizza Party, a unix tool for ordering pizza.

« older | 2007-10-13T07:00:01Z | newer »