From 39ae6d457ea07cc96b92d142827e9dbd8ae64031 Mon Sep 17 00:00:00 2001 From: Thomas Chmielowiec Date: Wed, 8 Feb 2017 19:20:55 +0100 Subject: [PATCH] Fixes #513 Update a linked field when editing a date manually without an open calendar. --- js/bootstrap-datetimepicker.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/js/bootstrap-datetimepicker.js b/js/bootstrap-datetimepicker.js index c7ba8bbe..c43b21e3 100644 --- a/js/bootstrap-datetimepicker.js +++ b/js/bootstrap-datetimepicker.js @@ -413,7 +413,20 @@ }, hide: function () { - if (!this.isVisible) return; + function _setValue() { + if ( + this.forceParse && + ( + this.isInput && this.element.val() || + this.hasInput && this.element.find('input').val() + ) + ) + this.setValue(); + }; + if (!this.isVisible) { + _setValue.call(this); + return; + } if (this.isInline) return; this.picker.hide(); $(window).off('resize', this.place); @@ -423,14 +436,8 @@ $(document).off('mousedown', this.hide); } - if ( - this.forceParse && - ( - this.isInput && this.element.val() || - this.hasInput && this.element.find('input').val() - ) - ) - this.setValue(); + _setValue.call(this); + this.isVisible = false; this.element.trigger({ type: 'hide',