diff options
| author | fwi-odoo <fwi@odoo.com> | 2016-11-22 13:55:03 +0100 |
|---|---|---|
| committer | fwi-odoo <fwi@odoo.com> | 2017-01-30 10:29:27 +0100 |
| commit | ad6fd5f838e174cc6e354bb9998e1e5bc4e8d4f1 (patch) | |
| tree | 430a782eb2c08fa907473a7a31965d3859f279b9 /addons/web/static/src/js/widgets/date_picker.js | |
| parent | c5af1d215f040a244f108730e8eb1c794353591c (diff) | |
[REF] web: update bootstrap-datetimepicker lib and adapt datepicker widget
from 3.0.3 to 4.17.42
Diffstat (limited to 'addons/web/static/src/js/widgets/date_picker.js')
| -rw-r--r-- | addons/web/static/src/js/widgets/date_picker.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js index 7f622f10820..74286da6df3 100644 --- a/addons/web/static/src/js/widgets/date_picker.js +++ b/addons/web/static/src/js/widgets/date_picker.js @@ -23,19 +23,20 @@ var DateWidget = Widget.extend({ this.name = parent.name; this.options = _.defaults(options || {}, { - pickTime: this.type_of_date === 'datetime', - useSeconds: this.type_of_date === 'datetime', - startDate: moment({ y: 1900 }), - endDate: moment().add(200, "y"), + format : time.strftime_to_moment_format((this.type_of_date === 'datetime')? (l10n.date_format + ' ' + l10n.time_format) : l10n.date_format), + minDate: moment({ y: 1900 }), + maxDate: moment().add(200, "y"), calendarWeeks: true, icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', + next: 'fa fa-chevron-right', + previous: 'fa fa-chevron-left', up: 'fa fa-chevron-up', - down: 'fa fa-chevron-down' + down: 'fa fa-chevron-down', }, - language : moment.locale(), - format : time.strftime_to_moment_format((this.type_of_date === 'datetime')? (l10n.date_format + ' ' + l10n.time_format) : l10n.date_format), + locale : moment.locale(), + allowInputToggle: true, }); }, start: function() { @@ -48,7 +49,7 @@ var DateWidget = Widget.extend({ set_value: function(value) { this.set({'value': value}); this.$input.val((value)? this.format_client(value) : ''); - this.picker.setValue(this.format_client(value)); + this.picker.date(this.format_client(value)); }, get_value: function() { return this.get('value'); @@ -88,12 +89,7 @@ var DateWidget = Widget.extend({ value = this.$input.val(); } - // temporarily set pickTime to true to bypass datetimepicker hiding on setValue - // see https://github.com/Eonasdan/bootstrap-datetimepicker/issues/603 - var saved_picktime = this.picker.options.pickTime; - this.picker.options.pickTime = true; - this.picker.setValue(value); - this.picker.options.pickTime = saved_picktime; + this.picker.date(value); }, change_datetime: function(e) { if(this.is_valid()) { |
