Closed Bug 149246 Opened 22 years ago Closed 22 years ago

need to be able to specify relative dates in days


(Bugzilla :: Query/Bug List, enhancement)

Not set



Bugzilla 2.18


(Reporter: michael, Assigned: michael)




(1 file, 3 obsolete files)

beeing able to specify relative dates allows savings of queries for the last
week or periods back.

syntax: -?\d+[dD]     ("-20d" means 20 days back, "20D" the same)
Attached patch diff -u of patch (obsolete) — Splinter Review
-> patch author, keywords and stuff. Also proposing for consideration in 2.18.
Assignee: endico → michael
Severity: normal → enhancement
Keywords: patch, review
Target Milestone: --- → Bugzilla 2.18
Attached patch diff -u of buglist.cgi (obsolete) — Splinter Review
this fix also supports relative dates in weeks, month, years and considers
Attachment #86387 - Attachment is obsolete: true
Comment on attachment 88279 [details] [diff] [review]
diff -u of buglist.cgi

Tested only quickly and seemed to work, so I'll just post some review nits
mostly about code readability:

>+        my ($n, $u, $date) = ($1, lc $2, time);

Please make those $n and $u something more verbose. Try $amount and $unit or
something similar. 

>+        my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($date);

Be consistent: use spaces after commas here, too. $month instead of $mon,

>+        $u='d', $n=7*$n+$wday if $u eq 'w';  # convert weeks to days
>+        $year -= $n, $mon=0 if $u eq 'y';
>+        $mon -= $n if $u eq 'm';

Please rewrite these as "if $unit eq 'w' { ... }". 

>+        while($mon<0) {$year--; $mon += 12;}

A space to separate the while and the (, and two more to separate the block
contents from the braces around it.

I hope that cuts it; I'll review again when I'm better awake. :-)
fixed review issues
Attachment #88279 - Attachment is obsolete: true
Comment on attachment 88287 [details] [diff] [review]
fixed review issues

This is fine with me, though I'm not certain about how the relative month
modifier should work. Currently if I type -2m now (on 20th June), I get bugs
starting from May 2002. 

I can't say whether that's correct or not; the alternative (making the above
testcase mean Apr 2002+) is not intuitively totally correct either. 

I think the most used option will be 'd' anyway, so we can fix those problems

r=jouni; if somebody else has the time to come and take a look at this, that's
great. If not, I'll give this the second r= eventually when some more testing
has been done. I'll patch this into our own installation now.
Attachment #88287 - Flags: review+
Is this the fix for bug 37749 ?
that patch allows relative dates in any date field in the query-page, so you 
could put "123d" in the date range field, and leave the other date range 
field "now".
if desired I could patch the relative day code to do that to fix the 37749 and 
43551 too.
No, bug 37749 is a sideeffect of how we handle the from/to stuff having the to
variable be blank.
>if desired I could patch the relative day code to do that to fix the 37749 and 
>43551 too.

Why not do that, but please don't embed the required fixes into this patch. This
is already very close to checkin, and we wouldn't want to delay it. Make another
patch on the top of this if necessary and attach it to the relevant bug.
Attachment #88287 - Flags: review+
Comment on attachment 88287 [details] [diff] [review]
fixed review issues

Okay, 2xr=jouni then. I'll check this in soon.
*** Bug 156411 has been marked as a duplicate of this bug. ***
Checked into the trunk. Thanks for the patch, Michael!

Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.181; previous revision: 1.180
Closed: 22 years ago
Resolution: --- → FIXED
*** Bug 175237 has been marked as a duplicate of this bug. ***
*** Bug 177697 has been marked as a duplicate of this bug. ***
Attached patch UI changes (obsolete) — Splinter Review
The functionality won't be very useful if you don't know it's there, so here's
some simple UI modifications.

Please file another bug if you consider UI changes necessary. This one is
already fixed, and any patches posted to closed bugs are bound to be easily
Comment on attachment 116467 [details] [diff] [review]
UI changes

OK, sorry, I filed the new bug 196373.
Attachment #116467 - Attachment is obsolete: true
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.