In my content types I set the calendar to allow for an End Date, but not as 'required'. Yet, each time I create an article type, the end date is defaulting as set to the start date. Is that normal? Or can I have the end date as an option, but by default not set?


#46 date-fixshowdate-1442718-46.patch590 bytesrodrigoaguilera
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#43 date-fixshowdate-1442718-43.patch605 bytesj0rd
PASSED: [[SimpleTest]]: [MySQL] 5,238 pass(es). View
#34 date-1442718-34.patch674 bytesBoobaa
#20 showenddatefix-1442718-20.patch674 bytesbones
PASSED: [[SimpleTest]]: [MySQL] 5,237 pass(es). View
#9 Show End Date.PNG9.38 KBwusel


miahon’s picture

Yes, I have same problem. I think this is Date -module Issue? I using version 7.x-2.1.

and when I am updating event comes an error...

"There are errors in Date value #1:
The End date must be greater than the Start date."

.... because the End date field is empty

KarenS’s picture

Project: Calendar » Date
Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Active » Fixed

This has nothing to do with Calendar.

You have several options for the default -- it can be the same as the start date, blank, or relative to the start date (like +1day).

kpaxman’s picture

Status: Fixed » Active

I have my default end date value set to "no default value", but when I create a new piece of content, the end date prepopulates with the start date. (I'm not using Calendar, just a content type with a Date field.)

miahon’s picture

Status: Active » Fixed

Hi, why that Show End Date checkbox default value is always checked?

When I updating my event (and when there is only start date) comes error...

"There are errors in Date value #1:
The End date must be greater than the Start date."

.... because the End date field is empty

Then I always have to unchecked that checkbox...

miahon’s picture

Status: Fixed » Active
jastraat’s picture

In my configuration, "show end date" has no default value, but the checkbox is checked by default when creating a new node. This isn't a big problem; I just uncheck the box, and the node saves without issue.

However, if I go back and edit the node, the "show end date" checkbox is checked again and I have to remember to uncheck it again or else the form throws a validation error. Not ideal -

jastraat’s picture

Category: support » bug
jastraat’s picture

Title: Calendar Setting Default End Date » "Show End Date" always checked by default when creating or editing a node
wusel’s picture

9.38 KB

When I import an Event with a date-field using Feeds, the new Event has NO end-date, because in
Show End Date
"Show End Date" is ALWAYS set, but the fields for the end-date are NOT shown.

The logic of this field "Show End Date" is NOT correct:
If it is checked, then the fields "date and time" are NOT shown. If it is NOT checked, then the fields "date and time" are shown.

[update - 03/03/2012]
This prevents Feeds from importing the end-date und -time.

I use:
Date 7.x-2.2+0-dev (2012-Feb-25)
Entity API 7.x-1.0-rc1+40-dev (2012-Feb-24)
Feeds 7.x-2.0-alpha4+39-dev (2012-Feb-09)


KarenS’s picture

Status: Active » Fixed

This was broken when I tried to fix problems created when you hide a field that has a default value. Made a change to try to fix that.

mshepherd’s picture

Status: Fixed » Active

I'm still having a problem with this - I've installed date 7.x-2.2+3-dev which includes the changes in this commit.

But the behaviour I still see is:

  • Create event node with Show End Date unticked & only add start date/time and save.
  • Edit the same node & you'll see that the Show End Date box is ticked
  • If you save the node without unticking the box, you get an error saying : There are errors in When value #1: The End date must be greater than the Start date.
wusel’s picture

I've installed "date 7.x-2.2+3-dev", too.
My #9 is not solved yet.

The text "Show End Date" is wrong, it must be "Don't show End Date" (the module date shows the end date field depending on this text).
But the import-module Feeds (and may be Migrate) thinks, this option is "Show End Date" and not "Don't show End Date".
So it sets this option in the wrong way during import.

If I add an new event (""), this is the same.

I hope, you can understand our problem and help us soon.
Thank you very much.

wusel’s picture

Please have a look at #1467830: Step-by-step instructions: Timezone-handling is wrong / editing and importing of date-fields are different.
With "Event 2" you can test this very well after building that scenario after step one or two.

bones’s picture

I am also experiencing the bug exactly as described in #11.
I have nodes with lots of date fields, some with end date and some without. I have to uncheck the Show End Date for each date with no end date every time I edit.
Using Date 7.x-2.2 at the moment. Is this last commit intended to fix this problem or the other issue in #9?

miahon’s picture

This is a problem which I tried to tell the # 1. I tested latest dev version, and i have to uncheck the Show End Date when editing dates with no end date... Is this bug or feature?

jastraat’s picture

I also still see this bug (It's really not user-friendly, so - bug.) in the latest version of dev.
"show end date" should not automatically check itself when editing an existing node.

jastraat’s picture

Perhaps this will help with figuring out the problem:
On line 299, $instance['required'] is coming up "true" even though to date is optional. The field is required though - and I think this means that with a required date field (even with optional to date), the "show to date" check box will always be checked.

change line 299 from
$show_todate = !empty($form_state['values']['show_todate']) || !empty($element['#default_value'][$to_field]) || $instance['required'];
$show_todate = !empty($form_state['values']['show_todate']) || !empty($element['#default_value'][$to_field]) || $field['settings']['todate'] == 'required';

geerlingguy’s picture

Same here:

"Show end date" should not automatically check itself when editing an existing node.

Whenever someone edits a node that doesn't have an end date, the show end date checkbox is still checked, and the user must manually un-check that box before saving the node, otherwise the warning will appear saying the end value must be greater than the start value... a little confusing, to be sure.

lunk_rat’s picture

I am in the same boat as #18. Every time I edit a node the "show end date" box is checked. Un-ticking the box simply does not stick.

Not a huge deal, but will be a headache for clients and content editors, because you need to un-tick the box every time you edit the node or the node will not save.

bones’s picture

Status: Active » Needs review
674 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,237 pass(es). View

Fix in #17 seems to work for me.
Attached is a patch.

geerlingguy’s picture

Just manually applied patch in #20, and pending the testbot's test returning a pass, I'm RTBCing this patch; works perfectly on my site, fixes the problem, makes sense.

rv0’s picture

edit: sorry did not use latest dev :s

rv0’s picture

Status: Needs review » Needs work

(ignore, had to use latest dev)

rv0’s picture

Status: Needs work » Needs review
geerlingguy’s picture

Status: Needs review » Reviewed & tested by the community

RTBC patch in #20. Passed testbot, and everything works great on my local machine.

ar-jan’s picture

The patch applied cleanly to the latest -dev. You need to use the -dev version, apply the patch AND set the Default end date to "No default value", otherwise the Show end date option will still be checked upon node creation.

KarenS’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

I am unable to replicate this problem in the latest code. I need a specific example of how to see something that is broken. I followed the instructions above and they all work fine for me.

I need to know the type of date field, the settings for the field, the type of widget and the settings for the widget.

geerlingguy’s picture

Could be something from older versions of the Date module, perhaps. I'll create a test site and see if I can replicate on a fresh install.

wusel’s picture

Status: Needs work » Postponed (maintainer needs more info)

Step-by-step instructions to reproduce the problem:

Set the site-timezone to "Europe/Berlin".
Visit /admin/structure/types and click on "Add content type": Name = "Event", click on "Save and add fields". In line "Add new field", select Type of data to store = "Date (ISO format)", Label ="Event-Date", Field name = "field_event_date", Form element to edit the data = "Text field", then click on "Save".
On the page "Field settings": set "Collect an end date" to yes and "Time zone handling" to "No time zone conversion" and then click on "Save field settings".
On the page "Event settings" set "Required field" to yes and then click on "Save settings".
Visit /admin/structure/types/manage/event/display and on "Custom display settings" set all options (like "Teaser") to no and then click on "Save".
"Add content", select "Event": Title = "Event 2", set "Show End Date" to no, then change nothing, click on "Save".
Then edit "Event 2", change nothing and then click on "Save".

wusel’s picture

Status: Postponed (maintainer needs more info) » Needs work
bones’s picture

Status: Postponed (maintainer needs more info) » Needs work

My set up is similar to #29 but will confirm anyway:

Fieldtype: Date (ISO format)
Widget: popup calendar
Default value date: now
Default value end date: No default value
Required field: yes
Number of values : unlimited
Date attributes to collect: Year, month, day
Collect end date: yes
End date required: no
cache dates: no

C. Lee’s picture

#20 works.

KarenS’s picture

Status: Needs work » Fixed

I was having a lot of trouble replicating this, but finally was able to. Should be fixed now.

Boobaa’s picture

674 bytes

Here's a patch that applies cleanly to 7.x-2.2 for those poor souls like me who work with that.

BrightBold’s picture

Patch in #34 works for me with 7.x-2.2. Thanks @KarenS and @Boobaa!

Status: Fixed » Closed (fixed)

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

webankit’s picture

Status: Closed (fixed) » Active

Can't we have an option to choose behavior of end date on field setting page to show/hide end date by default

webankit’s picture

Status: Active » Closed (works as designed)

Sorry, it was simple just to remove default value for end date

ZeiP’s picture

Status: Closed (works as designed) » Closed (fixed)

More appropriate status.

Nallu’s picture

Title: "Show End Date" always checked by default when creating or editing a node » having default end date after clicking new menu
Component: Code » Views Filter
Assigned: Unassigned » Nallu
Priority: Normal » Critical
Status: Closed (fixed) » Active

i have start and end date filter where i have set cookies for start and end date as i need but it works 1ly if i click the( "today", "this month" ) buttons if i go to new menu the end date changed to today date.Help me plz i need my cookie to work there.

mshepherd’s picture

Title: having default end date after clicking new menu » "Show End Date" always checked by default when creating or editing a node
Component: Views Filter » Code
Assigned: Nallu » Unassigned
Priority: Critical » Normal
Status: Active » Closed (fixed)

Hi Nallu,
The bug reported above was fixed already. If you have another problem or need support, you should create a new issue.
It's best not to rename issues as it can make it more difficult for people to find help.

j0rd’s picture

IMHO, This patch is not valid. Correct me if I'm wrong, but I did previously fix this problem in my install, and since upgrading it persists.

But there's two issues here, which is eluded to in #12

The current behaviour of that checkbox is "DO NOT SHOW END DATE". That issue is displayed in comment #9, notice how the checkbox is checked, but the end date is not shown.

Only local images are allowed.

$element['#default_value'][$to_field] will always !empty() if the date field is set to default to current date (i believe this is the default) and if the node has been saved ($element['#default_value'][$to_field] gets set to $element['#default_value'][$from_field])

Valid Logic for this patch I believe is

$show_todate = !empty($form_state['values']['show_todate']) || (!empty($element['#default_value'][$to_field]) && $element['#default_value'][$to_field] != $element['#default_value'][$from_field]) || $field['settings']['todate'] == 'required';

But still this doesn't make sense because of reverse UI logic some where else.

j0rd’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review
605 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,238 pass(es). View

UPDATE. I didn't look at the code slightly above this, which will remove value2 via some logic. So my post above is invalid, except for the point I make about logic is reversed.

With that said, for my install at least (jquery_update is installed, but most #states work) I've had to flip the logic in #states to make it work as expected.

I can confirm on my live server, when viewing a node with "Start and End Date" that "Show end date" is checked, but only 1 input is displayed to end user.

And then only "start date" is given that "Show end Date" is unchecked, and both inputs are displayed.

The included patch is against 2.7, not -dev.

Other related issues.
#1246286: Problem with 'show end date' check box
#2042499: Show End Date incorrectly checked depending upon user creating/editing node.

paulap’s picture

#43 worked for me. THX

pog21’s picture

#43 worked for me, too. 7.x-2.x-dev.

Just noticed the patch was against 2.7 (Oops, I have dev installed. But working anyway).


rodrigoaguilera’s picture

590 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

Latest patch rebased against dev

jweirather’s picture

This approach doesn't appear to be working for me. I have a not-required end date, and this is my patched code in 7.x-2.8:

    if ($field['settings']['todate'] == 'optional') {
      $element[$to_field]['#states'] = array(
        'invisible' => array(
          'input[name="' . $show_id . '"]' => array('checked' => FALSE),

but the field is still loading by default with "Show End Date" checked, with the second set of date fields exposed to the visitor. Are there additional steps that I'm missing? Other ideas of where to look?

andriyun’s picture

Issue summary is not clear.
Also I tried to reproduce issue by steps from #29 or #31. But still can't reproduce

marvelownz’s picture

Was there ever a fix for post #3?
Maybe a value to be null or something for events that do not have a determined end date yet.

RAFA3L’s picture

Replace this line on file, all the patchs above doesn't work for me

  $show_todate = !empty($form_state['values']['show_todate']) || !empty($element['#default_value'][$to_field]) || $field['settings']['todate'] == 'required';


    $show_todate = !empty($form_state['values']['show_todate']) || $element['#default_value'][$to_field] != $element['#default_value'][$from_field] || $field['settings']['todate'] == 'required';

RAFA3L’s picture

Sorry for the flow, after a few tests saving a node I notice that the problem is if you use "default date" setting, yo can set it to "no default value" or change this line:

  if (!$date_is_default && $field['settings']['todate'] != 'required'


  if ($field['settings']['todate'] != 'required'
dunen’s picture

Steps to reproduce:
1. Create a Content Type with a date field
2. Under Date Field Settings:
a) Check the box for "Collect an end date"
b) Uncheck the box for "Required"
3. Create new content
4. You'll see that "Show End Date" is checked by default and the start date and end date are automatically set by default to the current day

Only local images are allowed.

arunkumark’s picture

In my project, i want end date as optional. I have patched to collect end date as required, optional and the user may decide.

Related Issue and patch Date range needs "open" end date

Collect Enddate