Skip to content

Instantly share code, notes, and snippets.

@wcandillon
Created May 19, 2015 01:17
Show Gist options
  • Save wcandillon/7cfb8f010cdde973064e to your computer and use it in GitHub Desktop.
Save wcandillon/7cfb8f010cdde973064e to your computer and use it in GitHub Desktop.
declare function local:is_in_date_range($index_entry, $date_filter) {
let $now := if ($date_filter!='')
then $date_filter
else current-date() - xs:dayTimeDuration(concat('P',14,'D'))
return
let $results :=
for $program in $index_entry/program
return
if (not($program/@end_dt castable as xs:date))
then true()
else if (xs:date($now) > xs:date($program/@end_dt))
then false()
else true()
return
every $result in $results
satisfies $result eq true()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment