Public Methods

SamBrishes edited this page Nov 15, 2018 · 1 revision

Public Methods

Version LastUpdate

Methods

.switchView(view)

view <string>
This method will change the view on the respective tail.DateTime instance. Pass "days", "months", "years" or "decades"! You can also use the magic strings "up" to go to an "upper" view (ex. days to months) or "down" to load an "lower" view (ex. years to months).

.switchDate(year, month, day, none)

year <int>, month <int>, day <int>, none <undefined|true>
This method will change the respective Date() object for the current calendar view. Pass the respective year, month and day which you want to show off within the interface. Pass true as fourth parameter to prevent the view to auto-reload to the new settings.

.switchMonth(month, year)

month <int>, year <int>
This is the deprecated version of switchDate(), which is still available and serves just as alias for the main function.

.switchYear(year)

year <int>
This is the deprecated version of switchDate(), which is still available and serves just as alias for the main function.

.browseView(type)

type <string>
This is just a helper method for the switchDate() function. You can pass "prev" (or previous) or "next" to load the "next" or "previous" page of the current view.

.fetchDate(date)

date <string>
This helper method "fetchs" the current available / selectable date and time within the respective interface. The first parameter is optional and will be preferable used and returned as Date Object.

.selectDate(year, month, date, hours, minutes, seconds)

year <int>, month <int>, day <int>, hours <int>, minutes <int>, seconds <int>
This method will select the passed date, and pass the value back to the input field.

.selectTime(hours, minutes, seconds)

hours <int>, minutes <int>, seconds <int>
This method is just an alias for .selectDate() and allows to "select" the time values only.

.open()

none
This method doesn't allow any parameter and just opens the Calendar Popup interface, if it isn't already open!

.close()

none
This method doesn't allow any parameter and just closes the Calendar Popup interface, if it is still open!

.toggle()

none
This method doesn't allow any parameter and just opens or close the Calendar Popup depending of the current state.

.on(event, callback, args)

event <string>, callback <callback>, args <undefined|array>
This method adds an callback function and custom / additional arguments, to the internal event listener. The current version offers the events "open", "close" and "change". The last one gets triggered if the Date/Time selection gets changed by the .selectDate() method.

You can also "hook" your function with the .addEventListener() method to the source element (which only fires the "change" event) or on the main DateTime Container, which is accessable through the instance variable ".dt". The main DateTime Container fires all 3 events, but uses the prefix "tail::<event_name>"! The ".detail" object contains the property "args", which holds the passed arguments, and "self" which holds the respective ProtoType Instance.

.remove()

none
This method doesn't allow any parameter and just removes the tail.DateTime Instance and Elements.

.reload()

none
This method doesn't allow any parameter and just removes and re-inits the tail.DateTime Instance and Elements.

.config(key, value, reload)

key <undefined|string|object>, value <undefined|multi>, reload <undefined|bool>
This method will allow you to get and set each single options during the runtime. Use No Parameter to get all options as object, pass an single options key as first parameter to receive the respective value, pass an value as second parameter to "set" the respective option to the new value.

You can also pass an key: value object construct as first parameter to set multiple options at once. The last parameter defines the reload-ability, pass false to prevent the auto-reload function, which gets otherwise called whenever you change a option.


Public Options

Events & Callbacks

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.