- Issue created by @DamienMcKenna
- π¨π¦Canada mandclu
Hi Damien, thanks for raising this interesting use case.
I'm a little surprised because adding this concept of duration to simplify the entry of dates was actually the original idea that sparked the creation of Smart Date. I would add that the default behaviour is designed to leverage patterns users are accustomed to in popular calendar tools like Office 365, Google Calendar, and so on. Finally, I would caution that visual simplicity does not always equate to simplicity of use, and to me this is an example of that.
All of that being said, what you have suggested shouldn't be hard to implement. I believe that the widget already hides the duration dropdown if the only allowed option is zero, so including "custom" in that logic should only require a small adjustment to the Javascript. Furthermore, if a site builder has set "custom" as the only allowed value, the dropdown will no longer be serving any useful purpose, so it does make sense to hide it.
The only possible argument for leaving it in would be if we could dynamically update the label, so it could reflect the calculated duration based on the user input. I believe I explored this a while back and had a proof-of-concept working, but IIRC the complexity of making that work across languages was why I abandoned it.
I will also add that for a while I've had an idea to make the duration element a little more dynamic. Rather than being a select that is always visible, the list of values could appear directly under the end time while the user is making changes. This would also align with popular calendar software, and make it more obvious (I think) have the elements relate to each other, in addition to visually cleaning up the widget.
- Assigned to DamienMcKenna
- πΊπΈUnited States DamienMcKenna NH, USA
The reason I tried out this module in the first place was because core's date field lacks a lot of functionality that the D7 module provided, most notably configurable granularity. For our use case we don't need the extras, so I've been trying to pair down the options presented in the UI. I'll follow up next week, I might have time to work on this myself.
- π¨π¦Canada mandclu
Actually I just tested this and it seems to work the way you want using both the 4.0.x and 4.1.x branch. Is it possible you're currently using a version older than 4.0.0?
- π¬π§United Kingdom williamsona
I am on v4.1.6
Initially it looks like the field is hidden on a new node but if you edit an existing node then a label pops up with no drop down.
See screenshots.
I think the js needs hideLabels(wrapper); somewhere to hide this? But I'm not sure where it would go.
My set up is:
Allowed duration values = custom
Default duration = 0
Smart date and time range
Provide a checkbox to make it an all day event. - π¬π§United Kingdom williamsona
This patch fixes my issue. I have tested this with more than 1 allowed value and it also works as expected.
- π¬π§United Kingdom williamsona
I'm not sure why but these patches don't apply as expected.
- π¬π§United Kingdom williamsona
I'm not sure why you need to show a duration label with no dropdown select. This patch just hides the parent element on an existing node.
- π¬π§United Kingdom williamsona
Sorry, I am working on trying to apply 2 patches and getting muddled up on the issue number. Please ignore all the other patches.
- π©πͺGermany jurgenhaas Gottmadingen
@mandclu following-up on our Slack discussion yesterday, I came across this issue as it sounds like providing a step in the direction I need to go. So, I can confirm what you said in #4 that if
custom
is the only option in the duration field, the drop-down is gone and we only see the label:So, that's good as step 1. What our customers expect, in addition, is that the start and end times are not linked when editing the start time of the date range. I appreciate your argument about other calendar tools and their widgets, but I do see a small difference in this use case: if the duration is custom, the start and end date should not be linked. Linking them when there is a selected duration like "2 hours" makes perfect sense, but not so much for custom duration.
Do you think we could unlink them for that scenario?