summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js24
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()) {