Methods
datedropper comes with the following methods which allow you to further customize your date picker.
show
This method opens the date picker on the selector on which it has been initialized. For instance, this allows you to define specific triggers through which the date picker should be opened.
EXAMPLE
$('#my-input').dateDropper('show');
hide
If the date picker is open, this method closes it for the selector on which datedropper has been initialized. This is another way to customize the behavior of the date picker by hiding it in response to specific triggers.
EXAMPLE
$('#my-input').dateDropper('hide');
destroy
This method closes the date picker and resets datedropper on the selector on which it was initialized. Therefore, after using the destroy method, the selector will no longer be able to activate the date picker.
EXAMPLE
$('#my-input').dateDropper('destroy');
set
This method allows you to edit any datedropper options on a selector on which datedropper was already initialized. Basically, the set method adds or updates already existing options.
EXAMPLE
$('#my-input').dateDropper('set',{ modal: true });
setDate
This method allows you to overwrite the default date on which the date picker is opened from a specific selector. For instance, the setDate method can be used to edit a date without manually acting on the picker, possibly in response to specific events.
Please note that the date must be provided as in the following example.
EXAMPLE
$('#my-input').dateDropper('setDate', {
d: 31,
m: 12,
y: 2018
});
getDate
This method, used on a selector on which datedropper has been initialized, returns a callback with an object containing the date in all the available formats.
For instance, a date like Tuesday, January 1st, 2019 is returned as follows:
Key | Value |
D | Tue |
F | January |
M | Jan |
S | 1st |
U | 1546300800 |
Y | 2019 |
d | 01 |
formatted | 01/01/2019 |
j | 1 |
l | Tuesday |
m | 01 |
n | 1 |
EXAMPLE
$('#my-input').dateDropper('getDate', function (date) {
console.log('The selected date is ' + date.F + date.S + ', ' + date.Y);
});