[rt-users] Problem in searching date

Alex Peters alex at peters.net
Tue Sep 2 07:43:41 EDT 2014


Your first debug line indicates that "Sunday" alone is not being parsed
into a meaningful time value.  This can be corrected by setting RT config
option $AmbiguousDayInPast to 1.

Your second debug line indicates that "last Sunday" is resolving to the
immediately previous Sunday, not the Sunday before the immediately previous
Sunday (which I suspect you want).  The Examples section of the
documentation for the most recent version (2013.1113 right now) of
Time::ParseDate[1] lists "Sunday before last" as valid input.  This might
come closer to achieving your desired outcome.

These times will not resolve to a date boundary, like midnight—they will
have the correct day, but use the current time.  This is probably not what
you want.  Consider prefixing "midnight" to each of your search values,
i.e. "midnight Sunday" and "midnight Sunday before last".

If you can't get the search to work as desired, you could simplify the
search to return matches between the current time and "1 week ago" and run
it weekly at midnight on Sunday via a dashboard email subscription.

[1] https://metacpan.org/pod/Time::ParseDate#EXAMPLES


On 2 September 2014 21:27, Chrilly Cheng <chrilde at gmail.com> wrote:

> Hi Alex,
>
> Thanks for replying.
>
> I found logs below, but no more details about it.
>
> [Tue Sep  2 10:55:32 2014] [debug]: RT::Date used Time::ParseDate to make
> 'Sunday' 0 (/usr/share/request-tracker4/lib/RT/Date.pm:222)
> [Tue Sep  2 10:55:32 2014] [debug]: RT::Date used Time::ParseDate to make
> 'last Sunday' 1409482532 (/usr/share/request-tracker4/lib/RT/Date.pm:222)
> [Tue Sep  2 10:55:32 2014] [debug]: RT::Date used Time::ParseDate to make
> 'Sunday' 0 (/usr/share/request-tracker4/lib/RT/Date.pm:222)
> [Tue Sep  2 10:55:32 2014] [debug]: RT::Date used Time::ParseDate to make
> 'last Sunday' 1409482532 (/usr/share/request-tracker4/lib/RT/Date.pm:222)
>
> And thanks for your reminding, I'm also aware of this, but our manager
> prefer that label, which is hard to config with the built-in attribute in
> RT.
>
>
> Br
> Vodar
>
>
> On Tue, Sep 2, 2014 at 6:35 PM, Alex Peters <alex at peters.net> wrote:
>
>> What does the debug log say when you run the search?
>>
>> There are some config options relevant to relative dates, but it's worth
>> verifying first that the two dates are being parsed at all.
>>
>> P.S.  I believe that the built-in Starts ticket attribute is intended to
>> function as a proposed start time.
>> On 02/09/2014 8:25 pm, "Chrilly Cheng" <chrilde at gmail.com> wrote:
>>
>>>  Do I need to do any setting of the week on server?
>>>
>>>
>>> On Tue, Sep 2, 2014 at 3:59 PM, Chrilly Cheng <chrilde at gmail.com> wrote:
>>>
>>>> Hi Guys,
>>>>
>>>> I was trying to create a qeury which returns all open tickets whose
>>>> "Proposed Start Date" are in this week, from specific queue. I tried with
>>>> some build-in variables in searching as showing below:
>>>>
>>>> Queue = 'ChangeRequest' AND (  Status != 'rejected' AND Status !=
>>>> 'resolved' ) AND 'CF.{Proposed Start Time}' > 'last Sunday' AND
>>>> 'CF.{Proposed Start Time}' < 'Sunday'
>>>>
>>>> but this query returns nothing. BTW, "Proposed Start Time" is a
>>>> datetime custom field applied to this queue.
>>>>
>>>> Can you please help to check on this, see whether it doesn't work? Many
>>>> thanks.
>>>>
>>>>
>>>> Br
>>>> Vodar
>>>>
>>>>
>>>>
>>>
>>> --
>>> RT Training - Boston, September 9-10
>>> http://bestpractical.com/training
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140902/35081141/attachment.htm>


More information about the rt-users mailing list