changeset 11184:dd154fe455c7 octave-forge

holidays: fix bug from r11369 when used dates were outside the hardcoded interval
author carandraug
date Sat, 27 Oct 2012 17:10:34 +0000
parents f0ba6c23f363
children 19edd1e57842
files main/financial/inst/holidays.m
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/financial/inst/holidays.m	Sat Oct 27 16:58:34 2012 +0000
+++ b/main/financial/inst/holidays.m	Sat Oct 27 17:10:34 2012 +0000
@@ -100,12 +100,10 @@
 
   if (sd > ed)
     hol = zeros (0,1);  # matlab compatibility 0x1
-  elseif (sd >= sd_hol && ed <= ed_hol)
-    ## if date interval is in between the list of holidays, just index them.
+  else
     hol = hol(hol >= sd & hol <= ed);
-  else
     if (sd < sd_hol); hol = [calculate_holidays(sd, sd_hol -1); hol]; endif
-    if (ed > ed_hol); hol = [hol; calculate_holidays(ed, ed_hol +1)]; endif
+    if (ed > ed_hol); hol = [hol; calculate_holidays(ed_hol +1, ed)]; endif
   endif
 
 endfunction