[Zope] Friday the 13th and date range search :-)

Lennart Regebro lennart@torped.se
Tue, 17 Sep 2002 16:12:48 +0200


Which version of Zope are you running?

----- Original Message -----
From: "Josef Meile" <jmeile@hotmail.com>
To: <zope@zope.org>
Sent: Thursday, September 12, 2002 3:37 PM
Subject: [Zope] Friday the 13th and date range search :-)


> Hi,
> I'm doing a date range search on a Catalog and I'm getting
> results that don't match the range. Before today, it had worked
> perfectly, but when I introduce dates between the 12th and
> 15th September it fails. Is it related with friday the 13th? :-)
>
> This is my code:
>
> id: searchInCatalog
> Parameter List: date1, date2
>
> catalog=context.Catalog
> return catalog(
>          {
>            'meta_type'       : 'EvDocDate',
>            'event_date'      : [date1,date2],
>            'event_date_usage': 'range:min:max',
>            'sort_on'         : 'event_date',
>          }
>        )
>
>
> I called it so:
>
> <dtml-let date1="'2002/09/12 8'" asDate1="_.DateTime(date1)"
>           date2="'2002/09/12 13'" asDate2="_.DateTime(date2)"
>           results="searchInCatalog(asDate1,asDate2)">
>   from: <dtml-var asDate1> til: <dtml-var asDate2>
>
>   <dtml-in results>
>     <dtml-let myObj="_['sequence-item']">
>       <dtml-var "myObj.event_date">    <dtml-var
> expr="(asDate1<=myObj.event_date) and (myObj.event_date<=asDate2)">
>     </dtml-let>
>   </dtml-in>
> </dtml-let>
>
> And it prints:
>
> from: 2002/09/12 08:00:00 GMT+2 til: 2002/09/12 13:00:00 GMT+2
>
>                 2002/09/16 07:00:00 GMT+2    0
>                 2002/09/16 07:00:00 GMT+2    0
>                 2002/09/16 09:00:00 GMT+2    0
>                 2002/09/16 09:00:00 GMT+2    0
>                 2002/09/16 10:00:00 GMT+2    0
>                 2002/09/16 10:00:00 GMT+2    0
>                 2002/09/16 11:00:00 GMT+2    0
>                 2002/09/16 11:00:00 GMT+2    0
>                 2002/09/16 12:00:00 GMT+2    0
>                 2002/09/16 12:00:00 GMT+2    0
>
> If you see the expresion "(asDate1<=myObj.event_date) and
> (myObj.event_date<=asDate2)"
> is allways false, then why is the catalog retuning this values? Does
anybody
> knows how to solve
> it?
>
> Thanks in advanced,
> Josef
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>