Created
August 8, 2024 13:51
-
-
Save GGontijo/eb8d61e85db64884ebf9356b72d40368 to your computer and use it in GitHub Desktop.
Obsidian sprint tasks template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
function getMonday(d) { | |
d = new Date(d); | |
var day = d.getDay(), | |
diff = d.getDate() - day + (day == 0 ? -6 : 1); // ajustar quando o dia for domingo | |
return new Date(d.setDate(diff)); | |
} | |
function formatDate(date) { | |
let dd = date.getDate(); | |
let mm = date.getMonth() + 1; | |
return `${dd < 10 ? '0' : ''}${dd}-${mm < 10 ? '0' : ''}${mm}`; | |
} | |
let today = new Date(); | |
let monday = getMonday(today); | |
let friday = new Date(monday); | |
friday.setDate(monday.getDate() + 4); | |
let title = `${formatDate(monday)} até ${formatDate(friday)}`; | |
let filePath = `Sprints/${title}`; | |
await tp.file.rename(title); | |
await tp.file.move(filePath); | |
const tasksString = ` | |
task1 | |
task2 | |
task3 | |
`; | |
const tasksArray = tasksString.trim().split('\n'); | |
const tasks = tasksArray.map(task => `- [ ] ${task.trim()}`).join('\n'); | |
const trackerEntries = tasksArray.map(task => ({ | |
name: task.trim(), | |
startTime: null, | |
endTime: null, | |
subEntries: null | |
})); | |
const trackerJSON = { | |
entries: trackerEntries | |
}; | |
tR += tasks + "\n\n"; | |
tR += "```timekeep\n"; | |
tR += JSON.stringify(trackerJSON, null, 2); | |
tR += "\n```"; | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment