Skip to content

Commit f561309

Browse files
committed
feat | add current days of year
1 parent 0f3768b commit f561309

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

src/data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ const ContactData = {
3939

4040
const InfoData = {
4141
paragraphHeader: [
42-
"Hi, i am Quyet by name - here is something about me ✌️."
42+
"Hi, my name is Quyet and here's a little bit about me! ✌️"
4343
],
4444
paragraphBody: [
45-
`🍀 I am a Python Developer, with ${getWorkingTimes()} in Web Development`,
46-
"🍀 I love computer, technology and animals",
47-
"🍀 Currently, DevOps is my main field",
48-
"Always and always welcome new kind friends!",
45+
`🍀 I have ${getWorkingTimes()} of experience in web development.`,
46+
"🍀 I love computer, technology and animals.",
47+
"🍀 Currently, I'm focused on DevOps as my primary field.",
4948
],
5049
paragraphFooter: [
51-
"Welcome to come here with me ♥️",
52-
"Hope you have a nice day ♥️"
50+
"I'm always happy to make new friends!",
51+
"Please feel free to reach out to me. ♥️",
52+
"Wishing you a wonderful day! ♥️",
5353
]
5454
};
5555

src/pages/Portfolio/common/function/functions.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ export function getWeekNumber(): number {
119119
return week_number
120120
}
121121

122+
// count the number of day in current year at this time
123+
export function getDayNumber(): number {
124+
let currentDate: any = new Date();
125+
let currentYear: any = currentDate.getFullYear();
126+
let firstDayOfYear: any = new Date(currentYear, 0, 1);
127+
return Math.ceil((currentDate - firstDayOfYear) / (1000 * 60 * 60 * 24));
128+
}
129+
130+
// count number of all the days in current year
131+
export function getDaysOfYear(): number {
132+
let today = new Date();
133+
let currentYear = today.getFullYear();
134+
return (currentYear % 4 === 0) ? 366 : 365;
135+
}
136+
122137
/**
123138
* when user click outside of the header,
124139
* close the header popup

src/pages/Portfolio/features/components/ExploreMore/ExploreMore.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import React from 'react'
2-
import { getWeekNumber } from '../../../common/function/functions'
2+
import { getWeekNumber, getDayNumber, getDaysOfYear } from '../../../common/function/functions'
33
import './ExploreMore.scss'
44

55
import ProgressBar from "@ramonak/react-progress-bar";
66

77
function ExploreMore() {
8-
const week_str = `Current week: ${getWeekNumber()} / 52`
9-
const percent = Math.floor(getWeekNumber() / 52 * 100)
8+
const week_str = `Current week: ${getWeekNumber()} / 52`
9+
const day_str = `Current day: ${getDayNumber()} / ${getDaysOfYear()}`
10+
const percent = Math.floor(getDayNumber() / getDaysOfYear() * 100)
1011
return (<>
1112
<div className='weekly-progress'>
1213
<span>{week_str}</span>
14+
<span>{day_str}</span>
1315
<ProgressBar
1416
completed={percent}
1517
labelSize={"10px"}

0 commit comments

Comments
 (0)