Click-draggable. Range-makeable. A better calendar.
new Timeframe(element, options);
-
months: The number of calendar months showing at once (default:2). -
format: The strftime format for the dates in the input fields (default:%b %d, %Y). (With Datejs, it takes Datejs formatting.) -
weekOffset: Override the localization's default weekday start with this option (e.g.,1will force the rows to start on Monday; use0for Sunday). -
startField,endField: Declare the range start and end input tags (by default, these are generated with the Timeframe). When thevalueattribute is pre-populated, the Timeframe will load with this range. -
previousButton,todayButton,nextButton,resetButton: Declare the navigational buttons (these are also generated by default with the Timeframe). -
earliest,latest: The earliest and latest selectable dates (accepts either aDateobject or aStringthat can be parsed withDate.parse()). -
minRange,maxRange: Limit the minimum and maximum possible range length (setmaxRangeto1to turn Timeframe into a regular old date picker).
Drop in a localized version of Datejs, and it should just work. An added bonus is that the text fields will live-parse more nicely! Just try "next tues."
var timeframe = new Timeframe();
timeframe.initialize(window.calendars, {
earliest: new Date(),
resetButton: $('#reset'),
startField: $('#start'),
endField: $('#end')
});
See it in action here.
Timeframe requires jQuery. It was built using 1.8, but older versions should work too.
- Stephen Celis ("stephencelis") - original developer of Timeframe (using Prototype)
- Justin Palmer ("Caged")
- Nik Wakelin ("codetocustomer")
- Sebastien Grosjean ("ZenCocoon")
- Will Bryant ("willbryant")
Find the latest version of Timeframe on Github.
More information can be found here.
Copyright (c) 2008-2011 Kyle Konrad, released under the MIT license.