Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Missing time on --start error #523

Open
mstmob opened this issue Apr 16, 2023 · 1 comment
Open

Missing time on --start error #523

mstmob opened this issue Apr 16, 2023 · 1 comment
Labels

Comments

@mstmob
Copy link
Contributor

mstmob commented Apr 16, 2023

todo list --start before 2023-03-01 results in the following error:

Traceback (most recent call last):
  File "/usr/bin/todo", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/todoman/cli.py", line 38, in wrapper
    return f(*a, **kw)
  File "/usr/lib/python3.10/site-packages/todoman/cli.py", line 658, in list
    click.echo(ctx.formatter.compact_multiple(todos, hide_list))
  File "/usr/lib/python3.10/site-packages/todoman/formatters.py", line 69, in compact_multiple
    for todo in todos:
  File "/usr/lib/python3.10/site-packages/todoman/model.py", line 795, in todos
    dt = dt.timestamp()
AttributeError: 'datetime.date' object has no attribute 'timestamp'. Did you mean: 'fromtimestamp'?

It works as expected if the time is specified, i.e.: todo list --start before 2023-03-01T10:00

Proposal: The start parameter should fallback to a default time, i.e. "00:00:00".

Furthermore the --start parameter should be documented correctly:
Currently no [before|after] is described in the documentation and zsh completion.

Version: todoman, version 4.2.1

@WhyNotHugo WhyNotHugo added the bug label Apr 16, 2023
@WhyNotHugo
Copy link
Member

Indeed, we should allow dates here. I think _validate_start_date_param should return Tuple[bool, datetime] | Tuple[bool, date] | None (it currently returns Tuple[bool, datetime] | None).

The docs should also definitely reflect the before/after usage.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants