Skip to content

Commit f1c9d8b

Browse files
feat: added age field
1 parent f71fbda commit f1c9d8b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ GITHUB="<github_token>"
1515
GITHUB_USERNAME="<github_username>"
1616

1717
DESCRIPTION="Your description"
18+
BIRTHDAY="2000-01-01" // Birthday date year/month/day
1819

1920
WAKATIME_URL="https://wakatime.com/share"
2021
WAKATIME_GLOBAL="/@AndcoolSystems/c20041f4-a965-47c3-ac36-7234e622a980.json" // WakaTime Global stats

src/widget/widget.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,16 @@ export class WidgetService {
8484
{}
8585
);
8686

87+
const startDate = new Date(process.env.BIRTHDAY);
88+
const endDate = new Date();
89+
const diffMs = endDate.getTime() - startDate.getTime();
90+
const diffDays = diffMs / (1000 * 60 * 60 * 24);
91+
const daysInYear = 365.2425;
92+
8793
json = {
8894
name: github_data?.data?.user?.name,
8995
description: process.env.DESCRIPTION,
96+
age: diffDays / daysInYear,
9097
github: {
9198
followers: github_data?.data?.user?.followers?.totalCount,
9299
total_stars: github_data?.total_stars,

0 commit comments

Comments
 (0)