[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Bug in Date Handling



Has anyone found SQR mishandling comparing two DATE fields when one of them
is the last day of a month and the other is the first day of the next month?
We're finding that SQR thinks these dates are the same - quite a serious
problem!

Here's a short program to demonstrate. If your version of SQR has the bug,
you should see every end-of-month date appear.

Thanks ... Jay Beller
===========================================

Begin-Setup
Declare-Variable
   Date $CC_Curr_Date
   Date $CC_Prev_Date
End-Declare
End-Setup

Begin-Program
   do CC-Main
End-Program

Begin-Procedure CC-Main
   SHOW 'Comparing Dates from 1/1/1999 forward...'
   show '========================================================='

   let #i = 0
   let $CC_Prev_Date = strtodate( '01/01/1999', 'MM/DD/YYYY' )

   while #i < 3000
      let $CC_Curr_Date = dateadd( $CC_Prev_Date, 'DAY', 1 )
      do compare-dates-wrong
      add 1 to #i
      let $CC_Prev_Date = $CC_Curr_Date
   end-while
End-Procedure CC-Main

begin-procedure compare-dates-wrong
   if $CC_Prev_Date = $CC_Curr_Date
      show
         $CC_Prev_Date edit 'MM/DD/YYYY HH:MI:SS am'
         ' = '
         $CC_Curr_Date edit 'MM/DD/YYYY HH:MI:SS am'
   else
      if $CC_Prev_Date > $CC_Curr_Date
         show
            $CC_Prev_Date edit 'MM/DD/YYYY HH:MI:SS am'
            ' > '
            $CC_Curr_Date edit 'MM/DD/YYYY HH:MI:SS am'
      end-if
   end-if
end-procedure