Problem/Motivation
The Duration field does not show up when All day is unchecked while editing a node, which was originally saved with 2 same dates and all day checked.
Before

After

Steps to reproduce
1. Create a new node which uses smart date module
2. Check All Day
3. Choose both the dates to be same
4. Save the node
5. Edit the node
6. Uncheck All Day
7. Duration field does not appear
Proposed resolution
The logic I have used with this patch checks if
the start date and end date field have been set, that is they are not empty
(which ideally they shouldn't, since we are re-editing this existing node)
for eg: start_date.value !== ''
and if the condition is successful
unset the style.display = 'none' to style.display = ''
and instead add style.visibility = 'hidden'
so now when All Day checkbox changes, the checkAllDay() function
will change the visibility attribute to 'visible' or 'hidden'
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | duration_hidden-3312142-3.patch | 1.02 KB | metasim |
| after.png | 25.37 KB | metasim | |
| before.png | 26.08 KB | metasim |
Comments
Comment #2
metasimComment #3
metasimComment #4
arun velusamy commentedI have tested it on Drupal version 9.4.x & Smart Date 3.6.1. The duration field works fine as expected. I can't reproduce the issue
Comment #5
mandclu commentedThanks for identifying this, and for providing a fix. This has been merged into the 3.7.x branch.
Comment #6
mandclu commentedAfter committing this, I realized that it broke the visibility of the duration field in the Manage Instances interface, so I added a small fix.