Closed (won't fix)
Project:
Date
Version:
6.x-2.x-dev
Component:
Date API
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Dec 2008 at 21:14 UTC
Updated:
28 Jul 2009 at 04:52 UTC
Created "datetime" type date field, "Start date", with repeat option. Default value set to "now". In global settings, set "To date" as "Optional".
When I create a content type which uses this date field, I see the "Start date" has red asterisks, but the "To date" doesn't. I expect this since the "To date" is optional. However, when I enter a "Start date" but don't change the "To date" and click "Submit", I get "The To date must be greater than the From date." error.
Am I doing something wrong or is this a bug? Thanks!
Comments
Comment #1
kulfi commentedAlso happening in 5.x
Comment #2
somebodysysop commentedCan I get some help on this? I don't know if there is something else I need to do or what. I thought "To date" is optional meant just that. But, when entering a node with an "optional" To date, I get the error if I leave it blank. Any suggestions whatsoever?
Comment #3
somebodysysop commentedLittle help, please?
Comment #4
mjohnq3 commentedThe 'Optional' option for the To date doesn't seem to work correctly. I have been able to avoid the error by setting the value of the To date to the same value (date) as the Start date. Of course, this is just a work-around.
Comment #5
somebodysysop commentedYes, thanks. I think "optional", however, should mean just that. Think it's possible to get a fix for this?
Comment #6
karens commentedI can't find any way to get this error. If I set up the 'to date' to be blank by default and empty and leave it empty when I submit the form, it works fine. If you see this problem it must be specific to the exact way you're using it so I'll need more details on exactly how you have things set up and what you're doing. Provide an export of the date field and an example of something you tried to enter into the 'From date' that expected a value in the 'To date'.
Comment #7
somebodysysop commentedThis little bit of info I didn't have. I was setting to date to be the same as from date or now. Hence the problem. Set it to blank, leave it empty, and it works. Thanks!
Comment #8
mjohnq3 commentedYes, if you set the the fields to be blank by default it does work when the 'To' date is optional. However, most event or task type applications usually have the default date set to the current date (the Now option). Perhaps the logic used to test the value of the 'To' field can be changed to: 1) if the 'To' date is less than the 'From' date, ignore it; 2) if they're equal, consider it a one day event; 3) if the 'To' date is greater then the 'From' date, just use it as entered.
Comment #9
karens commentedCan't do it that way (ignore an invalid value). I made the mistake early on of trying to silently 'fix' some problems and that is absolutely *not* what most people want to see happen. They want to see an error message that will alert the user to what is going on, not some code that silently and magically changes the input values.
You have an option to set the defaults any way you want, and I'm not going to override or ignore your defaults.
Plus it would make the code even more complex than it already is.
Comment #10
Dewi Morgan commentedWhile arguably not a bug, there are a few ways that this message could be avoided or made more intuitive.
1) Document at the admin end with a big red box "WARNING: you set the 'To:' date to be optional, but gave it a non-empty default value. That's probably not what you wanted. Your users will get apparently-meaningless errors unless they either assign it a new value, or delete your default value."
2) JavaScript it, so that setting the default value to, say, "same as From:" updates the To: field if the From: field changes.
3) JavaScript it, so that setting From: or To: to an overlapping value autocorrects the *other* value.
Given not everyone has JS enabled, I'd go for the less-friendly warning option 1, myself.
Comment #11
mjohnq3 commented+1
Not a bug just a UI issue.
Comment #12
schultetwin commentedHi,
Even after I make the default values for my date fields blank, I still get the following error: "The To date must be greater than the From date."
Here are the steps I followed, using date 6.x-2.x-dev.
1. Deleted existing CCK datetime field.
2. Create new CCK datetime with widget "Text field with custom import format"
3. Set Default value to blank and Default value for To date to blank.
4. Select To date as optional and granularity to years.
5. Select a custom made date format.
6. Select "No Time Zone Conversion."
7. Leave the rest of the options default.
8. Save cck field.
I then go and create a new node, leaving this datetime field blank, and when I try to save to node, I get the following error.
"There are errors in Years In the Program:
The To date must be greater than the From date."
(Years In the Program, of course, being the name of the cck datetime field.)
I'm using Drupal 6.10, with date 6.x-2.x-dev and cck 6.x-2.1
Comment #13
spyderboy commentedI am doing a listing of Bars with their opening hours. I want to be able to enter Foo Bar is open every Thurs - Sat from 8pm to 2am the next day.
Since I don't want Year or Month info, I have set the Custom Input Format to: H:i
I have set the To Date as Optional... maybe we can't or don't want to provide the closing hours.
"No Time Zone Conversion." is selected
Alas, when I try to enter my Foo Bar opening hours, I get "to date must be greater than the from date"
To boot, I get "The UNTIL value is required for repeating dates." Boo.
DateTime seems so powerful... but yikes, seems like I am trying to do something fairly simple here, but it's not obvious to me how to make it work. Help?
Comment #14
spyderboy commented(posted twice... sorry!)