From ab195097f5fae9014cb2d9af777abab3deedfeb7 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 2 May 2023 14:17:40 -0600 Subject: [PATCH] Et2DateDuration: Use integers for duration when we have a separate box for each duration, float when there's one box --- api/js/etemplate/Et2Date/Et2DateDuration.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Date/Et2DateDuration.ts b/api/js/etemplate/Et2Date/Et2DateDuration.ts index 673524f3f1..24aa40937c 100644 --- a/api/js/etemplate/Et2Date/Et2DateDuration.ts +++ b/api/js/etemplate/Et2Date/Et2DateDuration.ts @@ -534,14 +534,16 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement) { let inputs = []; let value = typeof this._display.value === "number" ? this._display.value : (this._display.value.split(":") || []); - for(let i = this.selectUnit ? 1 : this.displayFormat.length; i > 0; --i) + let count = this.selectUnit ? 1 : this.displayFormat.length; + for(let i = count; i > 0; --i) { let input = { name: "", title: "", value: typeof value == "number" ? value : ((this.selectUnit ? value.pop() : value[i]) || ""), min: undefined, - max: undefined + max: undefined, + precision: count == 1 ? 2 : 0 }; if(!this.selectUnit) { @@ -575,7 +577,7 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement) ` )} `;