When using the popup field option in a form where the "to" datetime field is set to optional, once you have entered a time it is not possible to go back and remove it. This might be needed due to a user entry error, or due to a revision of the node where the end time is no longer required. System returns invalid date/time in "to" field message.

Works OK in non popup text fields and select lists.

CommentFileSizeAuthor
#14 date_to-date-not-blank.patch775 byteszerolab

Comments

karens’s picture

Status: Active » Fixed

I can't replicate this in the latest -dev code. It may have been fixed since reported.

Status: Fixed » Closed (fixed)

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

les lim’s picture

Version: 6.x-2.0-rc6 » 6.x-2.2
Category: support » bug
Status: Closed (fixed) » Active

I can confirm this. The reason is there's no "delete" key on certain keyboard configurations (like the MacBook I was using today by chance).

However, this is probably more of an issue with jQuery UI than Date Pop-up.

dsms’s picture

I can confirm this issue too. It has nothing to do with a delete-key or whatever may os-specific. Even when To-Date is set to empty,
this issue occurs. Example: I create an article with default from-date set to "now" and to-date set to empty. On saving, the to-date
gets automatically the same value like the from-date..

this appears when the input fields use jquery calendar.

as a workaround I test in my templates if value == value2, clear to-date and run a content_update($node) .. after that
the field is really empty ;)

I don't know exactly where this might come from, perhaps from a jQuery problem, but my firebug researches didnt reveal
anything :(
I am more convinced that you maybe mix up value and value2 on node save / content save.

I experience this issue since I use 2.1 and now 2.2

matytsio’s picture

Version: 6.x-2.2 » 5.x-2.x-dev
Status: Active » Needs work

I too confirm this. Created a node with To-Date optional and blank, then come back to Edit... now the To-Date field sets itself to the same value as the From-Date. It'll save the blank values if I specifically erase them, but I would have to do this every time I edit this node. Very inconvenient and easy to forget...

Tested with both 5.x-2.7 and 5.x-2.x-dev versions with same results.

Aquilasfx’s picture

same problem..

bobgeier’s picture

Status: Needs work » Active

Cleaning up status.

bobgeier’s picture

Version: 5.x-2.x-dev » 6.x-2.2

Let's try this again. I can confirm that while the problem is less bad than when I originally posted, it is still present. Deleting a "To" date field no longer generates an error, but simply resets the "to" field to the from date. It is impossible to delete the "to" time field no matter how hard you try to make it go away.

I am using Macintosh equipment.

karens’s picture

Status: Active » Fixed

This is a Mac issue, it works fine in Windows. So I guess it is something about the jQuery used in the time field in that particular environment, which could be a jQuery bug or a bug in the timepicker code.

I'm not crazy about the timepicker and others have complained, but no one has provided any working alternatives. I guess for now I'll add an option to the site settings to turn the jQuery off for the timepicker so you can still use the jQuery popup calendar. You will then have to manually type values in for the time and will lose the timepicker's code that forces the values to only valid values.

dsms’s picture

its not only a Mac problem, I use FF and Opera on WinXP and the issue occurs here too.

matytsio’s picture

Version: 6.x-2.2 » 5.x-2.x-dev
Status: Fixed » Active

The issue still exists for me, I'm on Win XP.
Tested on Linux, all the same - To Date is automatically set to match From Date when intentionally left blank.

zerolab’s picture

Version: 5.x-2.x-dev » 6.x-2.2

The issue still exists.
Using Drupal 6.12
Tested on FF 3, Opera 10b on Ubuntu.

zerolab’s picture

it seems it has nothing to do with jQuery, from what I gather looking through the code.
I believe somewhere on the way, it doesn't take into account the possibility of having "to date" blank by default and not required.
Somewhere around the lines 469-489 in date/date_elements.inc there is a heavy error checking process that sets the to_date value to from_date in case it is empty, or throws an error if it fails.

I'll continue digging through the code, but conceptually, if someone sets the default value for the from/to fields to Blank in the field settings, in case they are not required, they should present no date.

zerolab’s picture

StatusFileSize
new775 bytes

UPDATE:
this is the solution I came up with. Did not test with repeat dates.

p.s. I just realized in my case, the "To" date field was autopopulated with "From" date when left blank.

bobgeier’s picture

I guess for now I'll add an option to the site settings to turn the jQuery off for the timepicker so you can still use the jQuery popup calendar. You will then have to manually type values in for the time and will lose the timepicker's code that forces the values to only valid values.

That would be a nice option in any event.

jmlavarenne’s picture

Title: Can't delete date/time in optional "To" date field with popup Date » Optional "To" date field should be allowed to be empty
Version: 6.x-2.2 » 6.x-2.4
Component: Date Popup » Date API

The 'To' date field should be allowed to be empty for Date fields that do not need a to Date.

For example, I'm using a Views list of nodes with a date field and I want to list the 'to' date field if it exists.
I don't want to list it if it's the same as the 'from' date.

jmlavarenne’s picture

Status: Active » Closed (duplicate)