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
none

After
hidden

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'

CommentFileSizeAuthor
#2 duration_hidden-3312142-3.patch1.02 KBmetasim
after.png25.37 KBmetasim
before.png26.08 KBmetasim

Comments

metasim created an issue. See original summary.

metasim’s picture

StatusFileSize
new1.02 KB
metasim’s picture

Status: Active » Needs review
arun velusamy’s picture

I 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

mandclu’s picture

Title: Duration field stays hidden when unchecking All day for same days » Duration field stays hidden when unchecking All day for saved events
Version: 3.6.1 » 3.7.x-dev
Status: Needs review » Fixed

Thanks for identifying this, and for providing a fix. This has been merged into the 3.7.x branch.

mandclu’s picture

After committing this, I realized that it broke the visibility of the duration field in the Manage Instances interface, so I added a small fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.