Preface
I first saw the “Weeks of your life” chart in Tim Urban’s Ted talk on Inside the Mind of a Master Procrastinator, it gave me this sudden on-the-face perspective to life. The thought that there’s only some many weeks of your life reaming really helps focus on the things that matter. Like the author of The Subtle Art of Not Giving a Fuck says, there’s only so many fucks that you can give, so give fucks judicially.
A physical chart works great, but Obsidian made more sense given my travel-centric lifestyle.
WoL in Obsidian Using DataviewJS
Yomaru Hananoshika has already taken a stab at building the WoL chart in Obsidian, it works. Checkout his video on it,
I made some really minor changes to his code snippet to get it to work for my Obsidian directory structure,
// Mention language as dataviewjs
function getContinuousWeekNumber(startDate, currentDate) {
const msPerWeek = 7 * 24 * 60 * 60 * 1000;
// Normalize both dates to UTC midnight for consistency
const start = Date.UTC(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
const current = Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
// Calculate weeks elapsed from startDate to currentDate
const weeksElapsed = Math.floor((current - start) / msPerWeek) + 1; // +1 to make week count start at 1
return weeksElapsed;
}
function isPastWeek(startDate, weekNumber) {
const now = new Date();
const currentWeek = getContinuousWeekNumber(startDate, now);
return weekNumber < currentWeek;
}
function getString(startDateStr, years) {
const startDate = new Date(startDateStr);
const endDate = new Date(startDate);
endDate.setFullYear(endDate.getFullYear() + years);
let result = '';
const weekSet = new Set();
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
const weekNo = getContinuousWeekNumber(startDate, currentDate);
const weekString = `Databases/Life/W-${weekNo}`;
if (!weekSet.has(weekString)) {
weekSet.add(weekString);
result += `[[${weekString}| ${isPastWeek(startDate, weekNo) ? '☑️' : '◻️'}]]`;
}
currentDate.setDate(currentDate.getDate() + 1);
}
return result;
}
dv.paragraph(getString("2002-06-23", 40));My only problem with Dataviewjs is that the chart load time is noticeable and bogs down on my Vaults resources (makes Obsidian laggy)!
WoL in Obsidian Using Plugins
I noticed mentions of a Plugin to do the same in Reddit, it is a work-in-progess at this time.
Thread: https://www.reddit.com/r/ObsidianMD/comments/1k41tp7/comment/mo9lfv7/?context=3