forked from ksalzke/miscellaneous-omnifocus-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markDueTasksAsMIT.omnijs
45 lines (40 loc) · 1.1 KB
/
markDueTasksAsMIT.omnijs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*{
"type": "action",
"targets": ["omnifocus"],
"author": "Kaitlin Salzke",
"identifier": "com.KaitlinSalzke.markDueTasksAsMIT",
"version": "1.0",
"description": "Tag tasks due today with 'MIT'",
"label": "Mark Due As MIT",
"shortLabel": "Mark Due As MIT"
}*/
var _ = (function() {
var action = new PlugIn.Action(function(selection, sender) {
var now = new Date();
var today = Calendar.current.startOfDay(now);
console.log(today);
var tasksDueToday = new Array();
library.apply(function(item) {
if (item instanceof Project && item.task.hasChildren) {
item.task.children.forEach(tsk => {
if (tsk.effectiveDueDate !== null) {
if (
Calendar.current.startOfDay(tsk.effectiveDueDate).getTime() ==
today.getTime()
) {
tasksDueToday.push(tsk);
}
}
});
}
});
tasksDueToday.forEach(task => {
task.addTag(tagNamed("Status").tagNamed("🎯 MIT"));
});
});
action.validate = function(selection, sender) {
return true;
};
return action;
})();
_;