Methods
Instance Methods
Instance methods are available through the intimidatetime jQuery plugin. Calling these methods resemble:
var myPicker = $('.selector').intimidatetime();
mypicker.intimidatetime('open'); // open the picker
The following instance methods are currently available:
- .intimidatetime('enable')
-
Enables the intimidatetime picker.
- return
- jQuery element
- .intimidatetime('disable')
-
Disables the intimidatetime picker.
- return
- jQuery element
- .intimidatetime('destroy')
-
Disables and removes the intimidatetime picker.
- return
- jQuery element
- .intimidatetime('open')
-
Opens the picker manually.
- return
- jQuery element
- .intimidatetime('close')
-
Closes the picker manually.
- return
- jQuery element
- .intimidatetime('option', 'key', 'value')
-
Gets or sets an option.
- key
- String of the option value to get or set
- value
- (optional) Value to set the option to.
- return
- When setting the jQuery element. When getting returns the option's value.
- .intimidatetime('value', val)
-
Gets or sets the picker's value.
- value
- (optional) A Date object, or when using ranges and array of Date objects
- return
- When setting the jQuery element. When getting returns the value (single Date or array of Dates when using ranges).
- .intimidatetime('refresh')
-
Rebuilds the picker.
- return
- jQuery element
Utility Methods
Utility/Static Methods are available through the $.intimidatetime object, so calling them resembles:
var num = $.intimidatetime.daysInMonth(5, 2001);
The following utility methods are available:
- setDefaults(options)
-
Sets the defaults for intimidatetime instances
- options
- object of intimidatetime options
- return
- $.intimidatetime object
- dateClone(date)
-
Creates a clone of a date, with Intimidatetime's microsecond and timezone support.
- date
- Javascript Date object to clone
- return
- A new javascript Date object with the same value as requested
- dateParse(date, format, options)
-
Parse a date string with the specified format
- date
- A date string
- format
- A format string (see formatting options)
- options
- Object of option values (see options and i18n)
- return
- A javascript Date object
- dateRangeParse(dates, format, delimiter, options)
-
Parse a date string of date ranges with the specified format, dates split by delimiter
- dates
- A string dates
- format
- A format string for a single date(see formatting options)
- delimiter
- A string that delimits each date.
- options
- Object of option values (see options and i18n)
- return
- Array of javascript Date objects
- dateRelative(date, relative)
-
Compute and return a new date relative to the given one.
- date
- A javascript Date to base the calculation from
- relative
- A string with a date calclulation (ex: "+2y", "-1M+5d"). Use a +/- followed by the number of units followed by the unit (y=year, M=month, d=day, h=hour, m=minute, s=second, l=millisecond, c=microsecond).
- return
- A javascript Date object of the new date value.
- dateFormat(date, format, options)
-
Format a Date object to the given format
- date
- A javascript Date object
- format
- A format string (see formatting options)
- options
- Object of option values (see options and i18n)
- return
- A string of the formattd date
- dateRangeFormat: function(dates, format, delimiter, options)
-
Format an array of dates into a date range string with the specified format, dates split by delimiter
- dates
- A array of Javascript Date objects
- format
- A format string for a single date(see formatting options)
- delimiter
- A string that delimits each date.
- options
- Object of option values (see options and i18n)
- return
- A string of formatted dates
- timezoneOffsetNumber(tzString, lookup)
-
Compute the number of minutes offset for a timezone string (ex: "-0400" gives 240)
- tzString
- A timezone string (ex: "-0400" or "Z" for iso1806
- lookup
- Object of timezone translation key value pairs. When the tzString isn't directly computable it will try to lookup the string. For example if you pass "EST" it may not be directly computable, if the lookup contains { "260": "EST" } it can return a value. See timezone names in Options.
- return
- Number of minutes needed to return to GMT
- daysInMonth(m, y)
-
Compute the number of days in a month
- m
- A number indicating the month. 0=January, 11=December, just like a javascript Date.
- y
- A number indicating the year.
- return
- Number of days in the month
- detectSupport(timeFormat)
-
Scan a timeFormat string and determine what features should be supported.
- timeFormat
- A string containing format tokens
- return
- An object of boolean values of each supported feature.
- log([])
-
Log to the console, when available any number of arguments
- args
- Any number of arguments of any type
- return
- Void