Skip to content

Commit

Permalink
Dynamic date to work out how long I've been a designer
Browse files Browse the repository at this point in the history
  • Loading branch information
LkeMitchll committed Sep 14, 2023
1 parent 5259525 commit 7b5fdaa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/_data/dates.cjs
Expand Up @@ -3,4 +3,11 @@ module.exports = {
const today = new Date();
return today.getFullYear();
},
yearsSinceIBecameADesigner() {
const startDate = new Date('2011-09-01');
const currentDate = new Date();
const timeDiff = Math.abs(currentDate - startDate);
const yearsPassed = Math.floor(timeDiff / (1000 * 60 * 60 * 24 * 365));
return yearsPassed;
},
};
2 changes: 1 addition & 1 deletion src/_includes/layouts/about.njk
Expand Up @@ -6,7 +6,7 @@ title: About
<header class="flow | gap-x-large">
{% include "components/nav.njk" %}
<p class="measure">
I’ve been a designer and front-end engineer for more than 10 years.
I’ve been a designer and front-end engineer for more than {{ dates.yearsSinceIBecameADesigner() }} years.
I started out as a Graphic Designer, around 2014 I transitioned to Product Design.
Since then I have worked with clients of all sizes in many different industries.
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/index.njk
Expand Up @@ -17,7 +17,7 @@ title: Product Designer
Digital product designer, design director, and user experience engineer for
<a href="https://www.thoughtbot.com">thoughtbot</a>.
Specialising in design strategy, process, and systems across
multiple industries for more than 10 years.
multiple industries for more than {{ dates.yearsSinceIBecameADesigner() }} years.
</p>
</header>

Expand Down

0 comments on commit 7b5fdaa

Please sign in to comment.