new MtrDatepicker(inputConfig)
The main class of the MtrDatepicker
Here inside is covered everything that you need to know
Parameters:
Name | Type | Description |
---|---|---|
inputConfig |
Object | used for user configurations |
- Source:
Members
(inner) xDown
Touch Support
http://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android
- Source:
Methods
(inner) addClass(element, className)
A simple shortcut function to add a class to specific element
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | |
className |
string |
- Source:
(inner) clone(obj) → {Object}
A simple function which makes a clone of a specific JS Object
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Object
(inner) createElementValues(elementConfig) → {HtmlElement}
This function is creating a new set of HtmlElement which
contains the default values for a specific input
Parameters:
Name | Type | Description |
---|---|---|
elementConfig |
object |
- Source:
Returns:
- Type
- HtmlElement
(inner) createMarkup()
Generate the main markup used from the datepicker
This means that here we are generating input sliders for hours, minutes, months, dates and years
and a radio input for switching the time AM/PM
- Source:
(inner) createRadioInput(elementConfig) → {HtmlElement}
Create HtmlElement with a radio button control
Parameters:
Name | Type | Description |
---|---|---|
elementConfig |
object |
- Source:
Returns:
- Type
- HtmlElement
(inner) createRange(settings) → {array}
Create array of values for a specific range with a given step
Parameters:
Name | Type | Description |
---|---|---|
settings |
object |
- Source:
Returns:
- Type
- array
(inner) createRangeForDate()
Create a special range with dates for a specific month
- Source:
(inner) createSliderInput(elementConfig) → {HtmlElement}
This function is creating a slider input
It is generating the required markup and attaching the needed event listeners
The returned element is fully functional input field with arrows for navigating
through the values
Parameters:
Name | Type | Description |
---|---|---|
elementConfig |
object |
- Source:
Returns:
- Type
- HtmlElement
(inner) destroy()
Detach all event listeners and clear the markup of the component
- Source:
(inner) format(input) → {String}
Return datetime in specific format
Parameters:
Name | Type | Description |
---|---|---|
input |
String |
- Source:
Returns:
M,MM, MMM
D,DD
Y,YY, YYYY
h, hh
m, mm
a, AA
Z, ZZ
- Type
- String
(inner) handleTouchMove(evt) → {Number}
Parameters:
Name | Type | Description |
---|---|---|
evt |
Event |
- Source:
Returns:
- Type
- Number
(inner) init(inputConfig)
The main init function which prepares the datepicker for use
Parameters:
Name | Type | Description |
---|---|---|
inputConfig |
Object | used to setup datepicker specific features |
- Source:
(inner) isNumber(n) → {Boolean}
Check is a specific input a number
Parameters:
Name | Type | Description |
---|---|---|
n |
Number | String |
- Source:
Returns:
- Type
- Boolean
(inner) removeClass(element, className)
Short alias for a function which is removing a class name from a specific element
Parameters:
Name | Type | Description |
---|---|---|
element |
HtmlElement | |
className |
string |
- Source:
(inner) roundUpTimestamp(timestamp) → {Number}
Round up a timestamp to the closest minutes (11:35 to 11:40)
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
Number |
- Source:
Returns:
- Type
- Number
(inner) setConfig(input)
Attaching the user input config settings to override the default one
Parameters:
Name | Type | Description |
---|---|---|
input |
Object | user input settings |
- Source:
(inner) showInputSliderError(reference)
Add an error class to the current input slider when a validation has failed
Parameters:
Name | Type | Description |
---|---|---|
reference |
String | id to the specific element |
- Source:
(inner) smoothScrollTo()
Smoothly scroll element to the given target (element.scrollTop)
for the given duration
Returns a promise that's fulfilled when done, or rejected if
interrupted
- Source:
(inner) updateDate(newMonth, newYar)
Updating the date when a month or year is changed
It should recalculate the dates in the specific month and check
the position of the date (if it's bigger than the last date of the month)
Parameters:
Name | Type | Description |
---|---|---|
newMonth |
Number | |
newYar |
NUmber |
- Source:
(inner) updateInputSlider(reference, newValue)
Update the value of the input slider
Parameters:
Name | Type | Description |
---|---|---|
reference |
string | id to the specific element |
newValue |
integer |
- Source:
(inner) validateChange(target, newValue, oldValue) → {boolean}
This function is validating the change of the date
If the config.feature is enabled this function will prevent selecting dates
in the past
Parameters:
Name | Type | Description |
---|---|---|
target |
String | |
newValue |
Number | |
oldValue |
Number |
- Source:
Returns:
- Type
- boolean