 | zkestenbaum says:I've always wished that I could have Smart Lists that are more advanced and that reflect dates in the past. Here are searches that can not currently be done (without hardcoding dates that then need to be updated manually in Settings):
- All tasks that were due in the last 7 days - All tasks that were due so far this week - All tasks that were due so far this month - All tasks that were due last month
So, I came up with an alternate solution using javascript bookmarklets. I created a folder called RTM in my bookmarks bar, and under that folder I created one bookmarklet for each search that I want. When I click on any of the bookmarklets, it composes a search string, puts it in the search bar, and submits the search. Boom!
For each of the below bookmarklets, create a new bookmark and put the "javascript" part in the URL or address field.
"Last 7 days" javascript:function dateToString(date){ return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();}; startDateRange = new Date(); startDateRange.setDate(startDateRange.getDate() - 7); searchStr = 'dueAfter:' + dateToString(startDateRange) + ' and dueBefore:tomorrow'; document.getElementById("listFilter").value = searchStr; control.updateListFilter(); startDateRange = null;
"Month to date": javascript:function dateToString(date){ return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();}; startDateRange = new Date(); startDateRange.setDate(0); searchStr = 'dueAfter:' + dateToString(startDateRange) + ' and dueBefore:tomorrow'; document.getElementById("listFilter").value = searchStr; control.updateListFilter(); startDateRange = null;
"Week to date" javascript:function dateToString(date){ return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();}; startDateRange = new Date(); startDateRange.setDate(startDateRange.getDate() - startDateRange.getDay()); searchStr = 'dueAfter:' + dateToString(startDateRange) + ' and dueBefore:tomorrow'; document.getElementById("listFilter").value = searchStr; control.updateListFilter(); startDateRange = null;
"Last month" javascript:function dateToString(date){ return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();}; startDateRange = new Date(); startDateRange.setDate(startDateRange.getDate() - startDateRange.getDay() - 7); endDateRange = new Date(); endDateRange.setDate(endDateRange.getDate() - endDateRange.getDay() + 1); searchStr = 'dueAfter:' + dateToString(startDateRange) + ' and dueBefore:' + dateToString(endDateRange); document.getElementById("listFilter").value = searchStr; control.updateListFilter(); startDateRange = null; endDateRange = null;
"Last week" javascript:function dateToString(date){ return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();}; startDateRange = new Date(); startDateRange.setDate(startDateRange.getDate() - startDateRange.getDay() - 7); endDateRange = new Date(); endDateRange.setDate(endDateRange.getDate() - endDateRange.getDay() + 1); searchStr = 'dueAfter:' + dateToString(startDateRange) + ' and dueBefore:' + dateToString(endDateRange); document.getElementById("listFilter").value = searchStr; control.updateListFilter(); startDateRange = null; endDateRange = null;
Enjoy! And I look forward to seeing what other great searches people come up with.
Zach Posted at 8:08pm on October 18, 2012 |