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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | smart_date_default_values.png | 51.36 KB | sunlix |
Issue fork smart_date-3498221
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sunlixI digged a little bit into it.
I think the main problem is that if
customis the only allowed value in theduration_incrementsyou can't setcustomfor thedefault_duration. It will be casted to0because the config schema requires integer.By that in the smart_date.js the
setInitialDurationfunction hide the end date and end time field.This hiding is intended for non custom values. But
durationcan't be initially set tocustomdue to the integer casting fordefault_durationComment #3
sunlixComment #4
mandclu commentedI 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?
Comment #5
sunlixHey @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_date4.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. :-)
Comment #6
anybodyI'm having a similar issue, maybe the same:
Having
Hide the end date field unless it's different from the start date.widget setting enabled and I create a NEW node, the node creation form only shows the start date, unless I check "All day".So the workaround is either not using that option or checking "All day", then setting the end date and then unchecking "All day" again to have a different end date for fresh entities!
If the start date is empty, the end date should always show, I think. Otherwise, it's not even possible to select a different end date.
Comment #7
sunlixYes that is excatly our current "user workaround". :)
Comment #8
agoradesign commentedWhat commit exactly broke this behaviour? This is still a blocker for updating a customer website, where the editors use this field quite often.. also the configured separator is missing, as well as the end date (only the end timefield is shown upon toggling the all day checkbox)
Comment #10
agoradesign commentedComment #11
anybodyThanks @agoradesign looks like this was a "simple" bug? Maybe would be worth adding a test to ensure this won't break again in the future?
Comment #12
agoradesign commentedseems so, yes :) at least it works for me.. and as you can see, after calling calcDuration() , it's totally impossible that duration === 'custom' in that line
So, it seems, that this is a classical refactoring bug, that happened here..
I agree that a test would be great, but I cannot afford the time for it unfortunately
Comment #14
mandclu commentedThanks for the work here. Merged into the 4.3.x branch