jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

Why can't we get an option's value? #311

Closed kirpit closed 10 years ago

kirpit commented 10 years ago

I was quite furious while trying to set an input's value programatically by using setTheDate method, so I've solved in a workaround. See #310.

But while setting a value by triggering the set event, I needed the formatted value that I use differently for every other input. I see that this is done by callFormat (and why it isn't calcFormat anyway?). So I've checked every possible method that there is no way to get a single object's option value other than going low-level and trying to access private stuff.

We added another small method into the core.js file right after _setOption that solved our problem:

getOption: function(opt) {
    return this.__(opt);
},
jtsage commented 10 years ago

Good point. Added, with a slight enhancment - your version only pulls the i18n stuff - included pulls i18n and base 'options' object - it'll guess where it should look, but i've been pretty careful to not duplicate between them, so it should guess well.