# Buggy code
def date_in_range(date_range, date, debug=False, now=None):
    """Check if date is in the range specified.

    Format:
    * comma-separated clauses (AND)
    * clause: attribute comparison_operator value (spaces optional)
        * attribute: year, month, day, hour, month, second, weekday, isoweekday
          or empty for full datetime
        * comparison_operator: == != <= >= < >
        * value: integer, 'now' or dateutil-compatible date input

    The optional `now` parameter can be used to provide a specific `now` value
    (if none is provided, datetime.datetime.now() is used).
    """
    out = True

    for item in date_range.split(","):
        attribute, comparison_operator, value = CLAUSE.match(item.strip()).groups()
        if attribute in ("weekday", "isoweekday"):
            left = getattr(date, attribute)()
            right = int(value)
        elif attribute:
            left = getattr(date, attribute)
            right = int(value)
        elif value == "now":
            left = date
            right = now or datetime.datetime.now()
        else:
            left = date
            right = dateutil.parser.parse(value)
        if debug:  # pragma: no cover
            print("    <{0} {1} {2}>".format(left, comparison_operator, right))
        out = out and OPERATORS[comparison_operator](left, right)
    return out


# Traceback (ValueError)
Scanning posts........done!
.  render_posts:cache/pages/index.html
TaskError - taskid:render_posts:cache/pages/index.html
PythonAction Error
Traceback (most recent call last):
File "/Users/martin/.venv/nikola-dev/lib/python3.7/site-packages/doit/action.py", line 437, in execute
returned_value = self.py_callable(*self.args, **kwargs)
File "/Users/martin/Projects/nikola/nikola/post.py", line 716, in compile
lang)
File "/Users/martin/Projects/nikola/nikola/plugins/compile/markdown/__init__.py", line 122, in compile
output, shortcode_deps = self.compile_string(data, source, is_two_file, post, lang)
File "/Users/martin/Projects/nikola/nikola/plugins/compile/markdown/__init__.py", line 111, in compile_string
output, shortcode_deps = self.site.apply_shortcodes_uuid(output, shortcodes, filename=source_path, extra_context={'post': post})
File "/Users/martin/Projects/nikola/nikola/nikola.py", line 1726, in apply_shortcodes_uuid
replacement, _deps = shortcodes.apply_shortcodes(v, self.shortcode_registry, self, filename, lang=lang, extra_context=extra_context)
File "/Users/martin/Projects/nikola/nikola/shortcodes.py", line 370, in apply_shortcodes
res = f(*args, **kw)
File "/Users/martin/Projects/nikola/nikola/plugins/shortcode/post_list.py", line 201, in handler
filtered_timeline = [p for p in filtered_timeline if date_in_range(utils.html_unescape(date), p.date, now=_now)]
File "/Users/martin/Projects/nikola/nikola/plugins/shortcode/post_list.py", line 201, in <listcomp>
filtered_timeline = [p for p in filtered_timeline if date_in_range(utils.html_unescape(date), p.date, now=_now)]
File "/Users/martin/Projects/nikola/nikola/packages/datecond/__init__.py", line 80, in date_in_range
right = int(value)
ValueError: invalid literal for int() with base 10: 'now'

# Fixed code
def date_in_range(date_range, date, debug=False, now=None):
    """Check if date is in the range specified.

    Format:
    * comma-separated clauses (AND)
    * clause: attribute comparison_operator value (spaces optional)
        * attribute: year, month, day, hour, month, second, weekday, isoweekday
          or empty for full datetime
        * comparison_operator: == != <= >= < >
        * value: integer, 'now', 'today', or dateutil-compatible date input

    The optional `now` parameter can be used to provide a specific `now`/`today` value
    (if none is provided, datetime.datetime.now()/datetime.date.today() is used).
    """
    out = True

    for item in date_range.split(","):
        attribute, comparison_operator, value = CLAUSE.match(item.strip()).groups()
        if attribute in ("weekday", "isoweekday"):
            left = getattr(date, attribute)()
            right = int(value)
        elif value == "now":
            left = date
            right = now or datetime.datetime.now()
        elif value == "today":
            left = date.date() if isinstance(date, datetime.datetime) else date
            if now:
                right = now.date() if isinstance(now, datetime.datetime) else now
            else:
                right = datetime.date.today()
        elif attribute:
            left = getattr(date, attribute)
            right = int(value)
        else:
            left = date
            right = dateutil.parser.parse(value)
        if debug:  # pragma: no cover
            print("    <{0} {1} {2}>".format(left, comparison_operator, right))
        out = out and OPERATORS[comparison_operator](left, right)
    return out