View Issue Details

IDProjectCategoryView StatusLast Update
0004454mantisbtfilterspublic2018-02-07 02:47
Reportertom_z Assigned Tosyncguru  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionfixed 
Product Version0.19.0rc1 
Summary0004454: 31 February ???
Description

to refine filter, there's no control if the date is correct or not!

Additional Information

i suggest this calander javascript from www.totallysmartit.com

TagsNo tags attached.
Attached Files
mantis.bug.gif (30,426 bytes)   
mantis.bug.gif (30,426 bytes)   

Relationships

related to 0015276 assignedsyncguru Custom field "Date" 31 days every month. 
child of 0004181 closed Features in Mantis 1.1 release 
child of 0015281 assignedsyncguru Consistent user interface for date fields 

Activities

jlatour

jlatour

2004-09-01 17:10

reporter   ~0007365

Does it really matter all that much? Nice layout by the way!

vboctor

vboctor

2004-09-01 17:24

manager   ~0007367

I don't think it does matter, although we should be validating the filter dates on submit. However, in my opinion this problem will go away if/when we use a calendar control.

jlatour

jlatour

2004-09-01 17:26

reporter   ~0007370

Fine, fine... it can't hurt.

anarcat

anarcat

2005-08-05 14:47

reporter   ~0011083

The PEAR Date module is really useful to deal with dates and stuff like this. For example, the last day of the month could be found using an incantation like this:

$date = new Date("2005-07-01");
$end = $date->getPrevDay();
print $end->getDay();

(This will print "30").

Of course, the problem in the first place is the fact that you're free to choose a different month, but anyways... this at least gives an easy way to find the theorical bounds.

ryandesign

ryandesign

2005-08-07 16:30

reporter   ~0011106

Don't need a PEAR module to do that...

function last_day_of_month($month, $year) {
return date('d', mktime(12, 0, 0, $month + 1, 0, $year));
}

This would of course only be useful as a check that could be performed when submitting the form, to determine if the date is valid, and if it isn't, show an error then, and make the user go back to fix it. This would be fine IMHO.

To prevent the user from selecting an invalid date in the first place would involve a pretty complicated JavaScript and will most likely just annoy the user anyway: What if "February 28" is currently selected, and she wants to select "January 31", but tries to do so by changing the day select menu first, and then the month? A JavaScript that says "Beep: Invalid date!" as soon as she's got February 31 selected is just going to tick her off. And leap years are a PITA too.

giallu

giallu

2007-08-05 09:19

reporter   ~0015351

Any reason why we can't just use:

http://www.php.net/checkdate

to validate the date?

vboctor

vboctor

2007-08-05 17:27

manager   ~0015354

We have two options:

  1. Validate after Submit - In this case we can use checkdate().

  2. Disallow choosing an invalid date - In this case use a Javascript calendar control, I would also keep the server side checkdate() validation. If Javascript is disabled, then we can fall back to our current date entry interface + checkdate() validation.

atrol

atrol

2017-03-30 16:02

developer   ~0056286

Fixed by changes in PR to fix 0008957

cproensa

cproensa

2017-04-16 18:50

developer   ~0056592

Reopened. Due to regressions, the changes have been reverted and will be targeted to next release