Skip to content

Commit

Permalink
set task due dates from Linear
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Jun 15, 2023
1 parent 4882388 commit 5a90ac1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Linear.omnifocusjs/Resources/pull.js
Expand Up @@ -27,7 +27,7 @@
///////////////////////////
req.method = "POST";
req.bodyString =
'{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}';
'{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url dueDate team { name } project { name url } } } } }"}';
req.headers = {
"Content-Type": "application/json",
Authorization: key,
Expand Down Expand Up @@ -84,6 +84,11 @@
task.appendStringToNote(linearTask.url);
}
}
if (linearTask.dueDate) {
// set the date but strip off the time component
let date = new Date(linearTask.dueDate);
task.dueDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
}
}
if (app.platformName === "macOS") {
document.windows[0].perspective = Perspective.BuiltIn.Projects;
Expand Down
14 changes: 13 additions & 1 deletion Linear.omnifocusjs/Resources/pull.ts
Expand Up @@ -34,7 +34,7 @@
///////////////////////////
req.method = "POST";
req.bodyString =
'{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}';
'{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url dueDate team { name } project { name url } } } } }"}';
req.headers = {
"Content-Type": "application/json",
Authorization: key,
Expand Down Expand Up @@ -104,6 +104,18 @@
task.appendStringToNote(linearTask.url);
}
}
if (linearTask.dueDate) {
// set the date but strip off the time component
let date = new Date(linearTask.dueDate);
task.dueDate = new Date(
date.getFullYear(),
date.getMonth(),
date.getDate(),
0,
0,
0
);
}
}

if (app.platformName === "macOS") {
Expand Down

0 comments on commit 5a90ac1

Please sign in to comment.