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

Josef Meile jmeile@hotmail.com
Thu, 12 Sep 2002 15:37:57 +0200


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