Way to show tasks for an actual week from Monday to Sunday

If you don’t mind a (very) long query, you may adapt this one to filter from today up to this week’s Sunday, e.g.:

#+BEGIN_QUERY
{
 :title [:b "laterSameWeek"]
 :inputs [:today :+6d]
 :rules [
  [(laterSameWeek ?date-a ?date-b)

   [(mod ?date-a 100) ?monthday-a]
   [(mod ?date-a 10000) ?mod-a]
   [(quot ?mod-a 100) ?month-a]
   [(- ?month-a 8) ?month8-a]
   [(quot ?month8-a 6) ?month6-a]
   [(* ?month6-a 12) ?month12-a]
   [(- ?month-a ?month12-a) ?monthnum-a]
   [(inc ?monthnum-a) ?monthinc-a]
   [(* 13 ?monthinc-a) ?month13-a]
   [(quot ?month13-a 5) ?month5-a]
   [(quot ?date-a 10000) ?year-a]
   [(+ ?year-a ?month6-a) ?year6-a]
   [(mod ?year6-a 100) ?yearnum-a]
   [(quot ?yearnum-a 4) ?year4-a]
   [(quot ?year6-a 100) ?century-a]
   [(quot ?century-a 4) ?century4-a]
   [(* 5 ?century-a) ?century5-a]
   [(+ ?monthday-a ?month5-a ?yearnum-a ?year4-a ?century4-a ?century5-a) ?sum-a]
   [(mod ?sum-a 7) ?d-a]

   [(mod ?date-b 100) ?monthday-b]
   [(mod ?date-b 10000) ?mod-b]
   [(quot ?mod-b 100) ?month-b]
   [(- ?month-b 8) ?month8-b]
   [(quot ?month8-b 6) ?month6-b]
   [(* ?month6-b 12) ?month12-b]
   [(- ?month-b ?month12-b) ?monthnum-b]
   [(inc ?monthnum-b) ?monthinc-b]
   [(* 13 ?monthinc-b) ?month13-b]
   [(quot ?month13-b 5) ?month5-b]
   [(quot ?date-b 10000) ?year-b]
   [(+ ?year-b ?month6-b) ?year6-b]
   [(mod ?year6-b 100) ?yearnum-b]
   [(quot ?yearnum-b 4) ?year4-b]
   [(quot ?year6-b 100) ?century-b]
   [(quot ?century-b 4) ?century4-b]
   [(* 5 ?century-b) ?century5-b]
   [(+ ?monthday-b ?month5-b ?yearnum-b ?year4-b ?century4-b ?century5-b) ?sum-b]
   [(mod ?sum-b 7) ?d-b]

   [(- ?d-a 4) ?d4-a]
   [(- ?d-b 4) ?d4-b]
   [(quot ?d4-a 3) ?d3-a]
   [(quot ?d4-b 3) ?d3-b]
   [(* ?d3-a 7) ?d7-a]
   [(* ?d3-b 7) ?d7-b]
   [(- ?d-a ?d7-a) ?dnum-a]
   [(- ?d-b ?d7-b) ?dnum-b]
   [(>= ?dnum-b ?dnum-a)]
  ]
 ]
 :query [
  :find (pull ?b [*])
  :in $ ?today ?max %
  :where
   (or [?b :block/scheduled ?d] [?b :block/deadline ?d])
   [(>= ?d ?today)]
   [(<= ?d ?max)]
   (laterSameWeek ?today ?d)
 ]
}
#+END_QUERY
3 Likes