Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[bug]: 'thisweek' doesn't work in the date parser #258

Open
ltrubov opened this issue Oct 14, 2021 · 3 comments
Open

[bug]: 'thisweek' doesn't work in the date parser #258

ltrubov opened this issue Oct 14, 2021 · 3 comments

Comments

@ltrubov
Copy link

ltrubov commented Oct 14, 2021

The documentation lists thisweek as an option for task filtering, as do the help pages. There are also lastweek and nextweek options. These are wonky in terms of what's considered to be next or last week, but they're accepted. However, thisweek results in the following:

Screen Shot 2021-10-14 at 11 10 44 AM

This is a strange thing to overlook, but it should be relatively easy to fix, given that the other week options are in place. It'd also be nice to have thismonth, nextmonth and lastmonth parameters.

@sottey
Copy link

sottey commented Oct 20, 2023

I am looking into implementing this in my fork, Ultodo, but here is how I worked around it:

I have an alias:
_yesterday='echo Thu | tr '''[:upper:]''' '''[:lower:]''

that gets me the abbreviated day name in lowercase...

Then another alias:

alias week="ultralist l duebefore:$(_yesterday)"

This is a bit convoluted, but I needed yesterday because using today results in showing the 7 days up to today, since it uses closest monday. Using yesterday gets us this week.

I hope to implement thisweek soon so that aliases are not needed.

Thanks

@ltrubov
Copy link
Author

ltrubov commented Oct 20, 2023

@sottey will your fix make lastweek cover the previous 7 days? Because I think it'd be kind of odd -- a week is normally thought of as the set of 7 different consecutive days of the week (Monday - Sunday or Sunday - Saturday) depending on locale and convention, not any 7 days.

It makes more sense to have the week start on Monday -- then thisweek is any day between the most recent (including today) Monday and the closest upcoming (including today) Sunday, lastweek is the week starting the Monday before most recent, and nextweek is the week starting the Monday after the closest upcoming Sunday.

Take a look at my fix at #259 ; I've also added the monthly options -- and by comparison, this will make weekly ones standout -- nobody thinks "last month" as the 30 days before today -- it's assumed to be the calendar month, regardless of where in the current month we are.

@sottey
Copy link

sottey commented Oct 21, 2023

Hi @ltrubov ,

Yeah, that was what I did. I feel like "7 days from the most recent past Monday" makes the most sense. Your work in the input_parser was more elegant than mine so I incorporated it, thanks!

LOVE the month stuff you did. I have incorporated that as well. Thanks!

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

No branches or pull requests

2 participants