amsul / pickadate.js

The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
http://amsul.ca/pickadate.js
MIT License
7.7k stars 1.01k forks source link

Change an option after picker initialization #1192

Closed ErnestBrandi closed 4 years ago

ErnestBrandi commented 4 years ago

Hi, I can't find any solution to update an option value after the picker been initialized... For instance I'd like to setup the formatLabel function on the fly depending on a user action. Thanks

EDIT : anyaway I found a way of doing my thing, here is the code

let time_start = $('#time_start').pickatime().pickatime('picker');
let time_end   = $('#time_end').pickatime({
    formatLabel: function(time) {
        // blabla
    }
}).pickatime('picker');

time_start.on('close', function() {
    time_end.trigger('formatLabel');
    time_end.render();
});
woeterman94 commented 4 years ago

How did you solve this?

For instance I want to change the option "selectyear" for some datepickers (after they have been initialized)