Datetime Toolbocks
Intuitive Date Input Selection
The Datetime Toolbocks is a pure JavaScript library using DHTML and advanced date parsing to generate the date based on the grammar passed. The purpose of the Datetime Toolbocks is to simplify the date entering process using common terms we are all familiar with.
- Today
- tod
- tomorrow
- tom
- yesterday
- 6
- 6th
- 6th October
- 3rd of Feb
- 10th Feb 2004
- 14th of Februrary
- 12 feb
- 1 ja
- mon
- Friday
- next Friday
- next fri
- next m
- last Monday
- last mon
- last m
- 2004-8-8 (ISO)
- 2004-04-04
- 1/24/2005 (US)
- 4/26
- 10-24-2005
- Next Week
- Last Year
- Next Month
- 18.11.2004
- 2 years ago
- ten days from now
- 11 years from today
Installation
Ruby on Rails is the development framework of choice. Future implementations in such core JavaScript libraries as the Dojo Toolkit, YUI, GWT, and others are likely to follow.
In addition, I am also considering implementing it for Wordpress, Drupal, and other such frameworks. If you have already done so, or are interested in contributing such a plugin....
Please contact me!
To install the Datetime Toolbocks within Ruby on Rails, follow these simple steps.
- Install the datetime_toolbocks plugin. This will install the engines plugin as well if you don't already have it installed.
script/plugin install http://svn.toolbocks.com/plugins/datetime_toolbocks
-
Add the following within the "Rails::Initializer.run do |config|" block in config/environment.rb
config.plugins = ["engines", "*"]
- Add the following to <head> tag within the /views/layouts/application.rhtml
<%= javascript_include_tag 'prototype' %> <%= javascript_include_tag 'datetime_toolbocks', 'calendar', 'lang/calendar-en', 'calendar-setup', :plugin => 'datetime_toolbocks' %> <%= stylesheet_link_tag 'datetime_toolbocks', 'calendar-win2k-cold-1.css', :plugin => 'datetime_toolbocks' %>
- Restart your webserver of choice
-
Here are some sample calls to the the new toolbocks_date_select helper. Use any of them, or combination of the attributes within your views or helper classes just as you would for date_select
<%= toolbocks_date_select :model_name, :date_column %> <%= toolbocks_date_select :model_name, :date_column, { :format => 'us' } %> <%= toolbocks_date_select :model_name, :date_column, { :format => 'dd/mm/yyyy', :autoRollOver => false, :value => '11/10/1982' } %> <%= toolbocks_date_select :model_name, :date_column, { :name => 'custom[field_name]', :help => false } %> <%= toolbocks_date_select :model_name, :date_column, { :format => 'iso' }, { :align => 'Tl', :firstDay => '1' } %>If you want to see some more demo calls, check out the partial template/layout that is included in the plugin. -
Depending on when you generated your application, you may also need to update your javascript libraries. This should not cause any malfunctions in your working app, unless you have done any changes in any of the default libraries.
rake rails:update:javascripts
Repository
Public subversion access available at http://svn.toolbocks.com/datetime_toolbocks/.
Bugs & Feature Requests
If you find a bug or have a great idea for Datetime Toolbocks please do create a ticket so it can be enhanced for everyone else!
Support
If you are having trouble installing the Datetime Toolbocks, please sign up for our mailing list, and hopefully someone in ToolBocks user community may be able to assist you with their experience.
For commercial support, contact Nathaniel Brown for anything concerned with Datetime Toolbocks as well as providing any additional Ruby on Rails or AJAX development for your application.
Donate
If you like any of the Toolbocks libraries enough to use them, please do consider supporting the ongoing development by donating some of your conserved energy to the cause.
README and CHANGELOG
You can find the README available within the Subversion repository. As well, you can find the CHANGELOG containing all the new features within the repository.
License
The Datetime Toolbocks is released under a slightly modified GNU Lesser General Public License (version 2.1).
Copyright (c) 2006-2007 Nathaniel Brown
GNU Lesser General Public License
Version 2.1, February 1999
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Toolbocks, Inimit Innovations Inc., nor the names of
its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Feature Goals
- Inline drop down which shows some of the available choices to enter.
- Ability to have two calendars side by side for start/end dates
- New match: "two weeks from tomorrow", "one month from last monday", "1 year from (next\s)?friday"
- New match: "the day after tomorrow", "the day before yesterday"
- New match: "first monday in november"
- New match: "2nd wed in dec"
- Initial date validation with server side code (Ruby/PHP/etc) to ensure that the base date used via their time zone is correct.
- If a date is not matched, then use an AJAX extension/plugin (Ruby/PHP/etc) to try and make sense of it
- Utilize RUNT as the third party tool for Ruby
- Second or even inline box to enter the Time with same text based functionality
- Match: [all date matches] at 7pm
- Match: [all date matches] @ 7pm
- Match: 4am
- Match: 18:00
- Match: (1|one) hour[s]?
- Match: (5|five) min(ute[s]?)?
- Match: morning (return 9am - configurable time)
- Match: evening (return 5pm - configurable time)
- Match: now
- Have a suggestion? Please do email me