diff --git a/api/js/etemplate/et2_widget_date.js b/api/js/etemplate/et2_widget_date.js index 8e720de552..09ebf2e4c5 100644 --- a/api/js/etemplate/et2_widget_date.js +++ b/api/js/etemplate/et2_widget_date.js @@ -741,7 +741,7 @@ var et2_date_duration = /** @class */ (function (_super) { this.options.value = _value; if (!this.options.select_unit && this.options.display_format.length > 1) { for (var i = this.options.display_format.length; --i >= 0;) { - jQuery(this.duration[i]).val(this._unit_from_value(_value, this.options.display_format[i], i === this.options.display_format.length - 1)); + jQuery(this.duration[i]).val(this._unit_from_value(_value, this.options.display_format[i], !i)); } return; } diff --git a/api/js/etemplate/et2_widget_date.ts b/api/js/etemplate/et2_widget_date.ts index 14fb123b87..80f5a6b609 100644 --- a/api/js/etemplate/et2_widget_date.ts +++ b/api/js/etemplate/et2_widget_date.ts @@ -916,8 +916,7 @@ export class et2_date_duration extends et2_date { for (let i = this.options.display_format.length; --i >= 0;) { - jQuery(this.duration[i]).val(this._unit_from_value(_value, this.options.display_format[i], - i === this.options.display_format.length-1)); + jQuery(this.duration[i]).val(this._unit_from_value(_value, this.options.display_format[i], !i)); } return; }