From 638da52fa908dd8ae338747f4b0699d1acdee15d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 11 Sep 2020 20:22:34 +0200 Subject: [PATCH] fix date-duration fails with only one date-format eg. "m" --- api/js/etemplate/et2_widget_date.js | 4 ++-- api/js/etemplate/et2_widget_date.ts | 4 ++-- api/templates/default/etemplate2.css | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/et2_widget_date.js b/api/js/etemplate/et2_widget_date.js index 92a91b35fa..ced5c6f931 100644 --- a/api/js/etemplate/et2_widget_date.js +++ b/api/js/etemplate/et2_widget_date.js @@ -683,7 +683,7 @@ var et2_date_duration = /** @class */ (function (_super) { this.duration.text(display.value + " "); } // Set unit as figured for display - if (display.unit != this.options.display_format) { + if (display.unit && display.unit != this.options.display_format) { if (this.format && this.format.children().length > 1) { jQuery("option[value='" + display.unit + "']", this.format).attr('selected', 'selected'); } @@ -693,7 +693,7 @@ var et2_date_duration = /** @class */ (function (_super) { } }; et2_date_duration.prototype.set_display_format = function (format) { - if (format.length <= 1) { + if (format.length < 1) { this.node.remove('select.et2_date_duration'); this.format.remove(); this.format = null; diff --git a/api/js/etemplate/et2_widget_date.ts b/api/js/etemplate/et2_widget_date.ts index 16f9f14bdb..af77765406 100644 --- a/api/js/etemplate/et2_widget_date.ts +++ b/api/js/etemplate/et2_widget_date.ts @@ -844,7 +844,7 @@ export class et2_date_duration extends et2_date } // Set unit as figured for display - if(display.unit != this.options.display_format) + if(display.unit && display.unit != this.options.display_format) { if(this.format && this.format.children().length > 1) { jQuery("option[value='"+display.unit+"']",this.format).attr('selected','selected'); @@ -858,7 +858,7 @@ export class et2_date_duration extends et2_date set_display_format(format) { - if (format.length <= 1) + if (format.length < 1) { this.node.remove('select.et2_date_duration'); this.format.remove(); diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index beb7e5cfde..de77997079 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -524,6 +524,9 @@ span.et2_date span { span.et2_date_duration input.et2_date_duration{ width: 25%; } +span.et2_date_duration span { + vertical-align: -webkit-baseline-middle; +} .et2_date.required, .et2_date[required] { background-color: inherit; }