No end date/time field if 'custom' is the only allowed duration value

Created on 8 January 2025, 3 months ago

Problem/Motivation

If custom is the only allowed duration value the end time field is not visible. I have to select and deselect the all_date checkbox to make the end time field visible.

The end date field is also not visible. Also if the widget option "Hide the end date field unless it's different from the start date." is enabled. I do not get it how it works at all, so I deselected the option.

Steps to reproduce

Create a smart_date field with Recurring enabled and set to 12 month ahead.
Set default date value to current_date
Set Allowed duration value only to custom
Set default duration to 0

Proposed resolution

🐛 Bug report
Status

Active

Version

4.2

Component

Code

Created by

🇩🇪Germany sunlix Wesel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sunlix
  • 🇩🇪Germany sunlix Wesel

    I digged a little bit into it.

    I think the main problem is that if custom is the only allowed value in the duration_increments you can't set custom for the default_duration. It will be casted to 0 because the config schema requires integer.

    By that in the smart_date.js the setInitialDuration function hide the end date and end time field.
    This hiding is intended for non custom values. But duration can't be initially set to custom due to the integer casting for default_duration

  • 🇨🇦Canada mandclu

    I don't really understand the custom behaviour here. Should the widget treat "custom" as zero (for the sake of automatically calculating the end date based on the start but then allow the user to change the end to whatever they want?

  • 🇩🇪Germany sunlix Wesel

    Hey @mandclu,

    thank you for your response.
    Yes we are interpreting 'custom' as "The user choose what ever he want as end date/time".
    In smart_date 4.1 with 'custom' no end date / time calculation was done and if 'custom' was the only value provided the 'duration' field was not displayed. This was our use case with it.

    So yes, from my perspective, your interpretation is right. :-)

Production build 0.71.5 2024