Closed Bug 283609 Opened 19 years ago Closed 15 years ago

Search for relative dates in deadline

Categories

(Bugzilla :: Query/Bug List, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: havardw+bugzilla, Assigned: gregaryh)

References

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Epiphany/1.5.6 (Ubuntu) (Ubuntu package 1.0+dfsg.1-6ubuntu1)
Build Identifier: 

It would be nice if it was possible to search for relative dates in deadline, in
a similar way to the date ranges in "Bug Changes".

Some use cases for this would be to send whine mail for all open bugs that have
passed the deadline, or a saved search that shows bugs with deadline in the next
week.

Reproducible: Always

Steps to Reproduce:
I found out that it's possible to search for relative dates with the boolean
query operators, so I have no objections if someone wants to 'WONTFIX' this.
It seems silly to have exceptions to the ability to usea  relative date in a
field that simply asks for a date.  We may as well add this (eventually)
Status: UNCONFIRMED → NEW
Ever confirmed: true
patch to BUGZILLA-2_20-BRANCH to allow relative dates in deadline fields
How do you search for tickets with boolean operators between today and 7 days from now?
(In reply to comment #1)
> I found out that it's possible to search for relative dates with the boolean
> query operators, so I have no objections if someone wants to 'WONTFIX' this.

I would like to know this, too. Could you please explain how tow use relative dates with boolean query operators!
I just tried the provided patch and had to realize, that searching with relative dates only works in one direction: Searching for bugs that have a deadline from "1y" and till "now" are found properly, but I can't find bugs from "now" till "1y" (=> all bugs, that have a deadline within one year from now on). 

So the patch only provides search capabilities with relative features in the past, not in the future or did is miss anything?
OS: Linux → All
Hardware: PC → All
Magnus, are you interested in porting your patch to the CVS tip?
Assignee: query-and-buglist → mlewissmith
Target Milestone: --- → Bugzilla 2.24
(In reply to comment #6)

You can find all bugs with a deadline within one year from now on using a boolean search “deadline”-“is less than”-“+1y”. The “+” sign is important, letting it point into the future. If you omit the sign, “-” is implied.
Is there already a patch for Bugzilla 2.22?
(In reply to comment #9)
> Is there already a patch for Bugzilla 2.22?

No, there isn't. If there were one, you'd find it in the attachments on this bug.
Well, I don't know how to create a patch-file, but I just tried to migrate the patch of Magnus from version 2.20 to version 2.22. I think it should work, when you replace lines 351 to 368 of bugzilla-2.22\Bugzilla\Search.pm with the following code:

--------------------snip--------------------
      if ($params->param('deadlinefrom')){
        $deadlinefrom = trim(lc($params->param('deadlinefrom')));
        $deadlinefrom = '' if ($deadlinefrom eq 'now');
#        validate_date($deadlinefrom)
#          || ThrowUserError('illegal_date', {date => $deadlinefrom,
#                                             format => 'YYYY-MM-DD'});
        $sql_deadlinefrom = &::SqlQuote(SqlifyDate($deadlinefrom));
        push(@wherepart, "bugs.deadline >= $sql_deadlinefrom");
      }
      
      if ($params->param('deadlineto')){
        $deadlineto = trim(lc($params->param('deadlineto')));
        $deadlineto = '' if ($deadlineto eq 'now');
#        validate_date($deadlineto)
#          || ThrowUserError('illegal_date', {date => $deadlineto,
#                                             format => 'YYYY-MM-DD'});
        $sql_deadlineto = &::SqlQuote(SqlifyDate($deadlineto));
        push(@wherepart, "bugs.deadline <= $sql_deadlineto");
      }
--------------------snap--------------------

PS: template/en/default/search/search-help.html.tmpl can stay as it is (after patching with the patch for 2.20), because the help doesn't need to be changed in the new version.
This bug is retargetted to Bugzilla 3.2 for one of the following reasons:

- it has no assignee (except the default one)
- we don't expect someone to fix it in the next two weeks (i.e. before we freeze the trunk to prepare Bugzilla 3.0 RC1)
- it's not a blocker

If you are working on this bug and you think you will be able to submit a patch in the next two weeks, retarget this bug to 3.0.

If this bug is something you would like to see implemented in 3.0 but you are not a developer or you don't think you will be able to fix this bug yourself in the next two weeks, please *do not* retarget this bug.

If you think this bug should absolutely be fixed before we release 3.0, either ask on IRC or use the "blocking3.0 flag".
Target Milestone: Bugzilla 3.0 → Bugzilla 3.2
FYI:  You can search using relative dates on the Deadline in Bugzilla 3.0 using the boolean charts.

I tested with "greater than" and "less than", and with values of "+1d", "-1d", etc.

It would probably very useful to have this functionality in the "Deadline From/To" area as well.
Bugzilla 3.2 is now frozen. Only enhancements blocking 3.2 or specifically approved for 3.2 may be checked in to the 3.2 branch. If you would like to nominate your enhancement for Bugzilla 3.2, set the "blocking3.2" flag to "?", and either the target milestone will be changed back, or the blocking3.2 flag will be granted, if we will accept this enhancement for Bugzilla 3.2.
Target Milestone: Bugzilla 3.2 → Bugzilla 4.0
With the newer version allowing custom fields, one of them being a date field, all boolean searches involving a date filed should allow a relative date to be specified.

Example: We have a custom date field and there is no way to search for something like 'select bug_id, cf_assignee_goal from bugs where cf_assignee_goal < Now();'
Attached patch Tip (obsolete) — Splinter Review
This is a real easy fix using SqlifyDate in the Search. Tested on tip.
Assignee: mlewissmith → ghendricks
Attachment #210418 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #410349 - Flags: review?(LpSolit)
Attachment #410349 - Flags: review?(LpSolit) → review-
Comment on attachment 410349 [details] [diff] [review]
Tip

Works fine, but you have to fix the UI to mention (YYYY-MM-DD or relative dates) instead of the current (YYYY-MM-DD).

r=LpSolit if you fix that.
Target Milestone: Bugzilla 4.0 → Bugzilla 3.6
Attached patch Tip - V2Splinter Review
Attachment #410349 - Attachment is obsolete: true
Attachment #411222 - Flags: review?(LpSolit)
Attachment #411222 - Flags: review?(LpSolit) → review+
Comment on attachment 411222 [details] [diff] [review]
Tip - V2

r=LpSolit
Flags: approval+
    Checking in Bugzilla/Search.pm;
    /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v  <--  Search.pm
    new revision: 1.177; previous revision: 1.176
    done
    Checking in template/en/default/search/form.html.tmpl;
    /cvsroot/mozilla/webtools/bugzilla/template/en/default/search/form.html.tmpl,v  <--  form.html.tmpl
    new revision: 1.61; previous revision: 1.60
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes in bug 547466.
Keywords: relnote
Blocks: 590144
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: