From a23309d46c1cb1373d886a63cdc51e9d0c2fb2c0 Mon Sep 17 00:00:00 2001 From: t1m0n Date: Tue, 17 Nov 2015 11:59:28 +0300 Subject: [PATCH] improve update method, now it can refresh language option --- dist/js/datepicker.js | 1 + index.html | 6 ++++++ js/datepicker/datepicker.js | 1 + 3 files changed, 8 insertions(+) diff --git a/dist/js/datepicker.js b/dist/js/datepicker.js index f92b2b8..97b36a8 100644 --- a/dist/js/datepicker.js +++ b/dist/js/datepicker.js @@ -376,6 +376,7 @@ var Datepicker; this._createShortCuts(); this._syncWithMinMaxDates(); + this._defineLocale(this.opts.language); this.nav._addButtonsIfNeed(); this.nav._render(); this.views[this.currentView]._render(); diff --git a/index.html b/index.html index 20d642a..620acbf 100644 --- a/index.html +++ b/index.html @@ -37,6 +37,12 @@ .update('maxDate', date) } }) + + $('button').on('click', function () { + $start.data('datepicker').update({ + language: 'en' + }) + }); \ No newline at end of file diff --git a/js/datepicker/datepicker.js b/js/datepicker/datepicker.js index 8f5e8f8..135ff55 100644 --- a/js/datepicker/datepicker.js +++ b/js/datepicker/datepicker.js @@ -376,6 +376,7 @@ var Datepicker; this._createShortCuts(); this._syncWithMinMaxDates(); + this._defineLocale(this.opts.language); this.nav._addButtonsIfNeed(); this.nav._render(); this.views[this.currentView]._render();