From 93f17bea8bdec10850723506b4145038077b06b6 Mon Sep 17 00:00:00 2001 From: cadamsmith Date: Tue, 22 Apr 2025 19:12:55 -0500 Subject: [PATCH 1/3] fix date handling for timeline items --- content/timeline/bachelors_degree.md | 2 +- content/timeline/cws.md | 2 +- content/timeline/cws_coop.md | 2 +- content/timeline/masters_degree.md | 2 +- src/lib/components/Timeline.svelte | 32 +--------------------------- src/lib/types/TimelineItem.ts | 2 +- src/lib/utils/index.ts | 28 +----------------------- src/routes/+page.svelte | 1 - 8 files changed, 7 insertions(+), 64 deletions(-) diff --git a/content/timeline/bachelors_degree.md b/content/timeline/bachelors_degree.md index 42fcbb9..1315116 100644 --- a/content/timeline/bachelors_degree.md +++ b/content/timeline/bachelors_degree.md @@ -2,7 +2,7 @@ title: 'Bachelor of Software Engineering' company: 'Auburn University' group: 'Education' -dates: '08/01/2018 - 12/31/2022' +dates: 'Aug 2018 - Dec 2022' order: 0 url: 'https://auburn.edu' --- diff --git a/content/timeline/cws.md b/content/timeline/cws.md index 868bdf8..f3b4581 100644 --- a/content/timeline/cws.md +++ b/content/timeline/cws.md @@ -2,7 +2,7 @@ title: 'Associate Systems Engineer' company: 'Campus Web Solutions' group: 'Work' -dates: '01/01/2023 - Present' +dates: 'Jan 2023 - Present' order: 2 url: 'https://cws.auburn.edu/cws' --- diff --git a/content/timeline/cws_coop.md b/content/timeline/cws_coop.md index bee999d..b309556 100644 --- a/content/timeline/cws_coop.md +++ b/content/timeline/cws_coop.md @@ -2,7 +2,7 @@ title: 'Co-op Web Developer' company: 'Campus Web Solutions' group: 'Work' -dates: '01/01/2021 - 05/31/2021, 08/01/2021 - 12/31/2021, 05/01/2022 - 08/31/2022' +dates: 'Jan 2021 - May 2021, Aug 2021 - Dec 2021, May 2022 - Aug 2022' order: 1 url: 'https://cws.auburn.edu/cws' --- diff --git a/content/timeline/masters_degree.md b/content/timeline/masters_degree.md index b9f9326..43087be 100644 --- a/content/timeline/masters_degree.md +++ b/content/timeline/masters_degree.md @@ -2,7 +2,7 @@ title: 'Masters of Science in Computer Science and Software Engineering' company: 'Auburn University' group: 'Education' -dates: '01/01/2024 - Present' +dates: 'Jan 2024 - Present' order: 3 url: 'https://auburn.edu' --- diff --git a/src/lib/components/Timeline.svelte b/src/lib/components/Timeline.svelte index c6ed40e..b039703 100644 --- a/src/lib/components/Timeline.svelte +++ b/src/lib/components/Timeline.svelte @@ -5,36 +5,6 @@ let currentGroup = $state('Work'); - // format date range to be in the format of "Jan 2024 - Mar 2025" - function formatDateRange(start: string, end: string) { - const currentDate = new Date(); - const startDate = new Date(start); - const endDate = new Date(end); - - // Set all times to midnight for accurate day comparison - currentDate.setUTCHours(0, 0, 0, 0); - - // Check if endDate is today or in the future - if (endDate >= currentDate) { - return `${formatDate(startDate)} - Present`; - } - return `${formatDate(startDate)} - ${formatDate(endDate)}`; - } - - function formatDate(date: Date) { - return date.toLocaleDateString('en-US', { - month: 'short', - year: 'numeric', - timeZone: 'UTC' - }); - } - - function formatTimelineRange(dateRanges: [string, string][]) { - return dateRanges - .map((dateRange) => formatDateRange(dateRange[0], dateRange[1])) - .join(', '); - } - function handleGroupChange(group: string) { currentGroup = group; } @@ -64,7 +34,7 @@
-

{formatTimelineRange(timelineItem.dates)}

+

{timelineItem.dates}

{timelineItem.company}

{timelineItem.title}

diff --git a/src/lib/types/TimelineItem.ts b/src/lib/types/TimelineItem.ts index 98f719e..bad0244 100644 --- a/src/lib/types/TimelineItem.ts +++ b/src/lib/types/TimelineItem.ts @@ -3,6 +3,6 @@ export interface TimelineItem { company: string; group: string; order: number; - dates: [string, string][]; + dates: string; url: string; } diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 0455e7b..61ea619 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -72,37 +72,11 @@ export const fetchMarkdownTimelineItems = async (): Promise => { }; }; - // Process date ranges from string format to array of ISO date strings - // Example input: "January 2020 - March 2022, April 2022 - Present" - const dates = metadata.dates.split(',').map((date) => { - const [startDate, endDate] = date.trim().split(' - '); - - // Create dates with UTC to avoid timezone issues - const startDateObj = new Date(startDate); - - // Set to UTC midnight to avoid date shifting when converting to different timezones - startDateObj.setUTCHours(0, 0, 0, 0); - - let endDateObj: Date; - - // Handle 'Present' as the current date - if (endDate === 'Present') { - endDateObj = new Date(); - endDateObj.setUTCHours(0, 0, 0, 0); - } else { - endDateObj = new Date(endDate); - endDateObj.setUTCHours(0, 0, 0, 0); - } - - // Return as tuple of ISO strings for consistent date formatting - return [startDateObj.toISOString(), endDateObj.toISOString()] as [string, string]; - }); - return { title: metadata.title, company: metadata.company, group: metadata.group, - dates: dates, + dates: metadata.dates, order: metadata.order, url: metadata.url }; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7674571..fa5a3e2 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -8,7 +8,6 @@ const cwsWebsiteUrl = 'https://cws.auburn.edu/cws'; - // get years of work experience in 0.5 year increments const now = new Date(); const startDate = new Date(2023, 0, 1); // January 1, 2023 const monthsDiff = From e10db8630ce1a7e25b58b6644c73985ddd9a31fd Mon Sep 17 00:00:00 2001 From: cadamsmith Date: Tue, 22 Apr 2025 19:20:10 -0500 Subject: [PATCH 2/3] flix flexbox shifting in my journey section --- src/routes/+page.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index fa5a3e2..56c4628 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -318,6 +318,7 @@ .map-wrapper { width: 18rem; height: 15rem; + flex-shrink: 0; } .journey-content { From cd261ba235afbbed8d49cfa665be1007d90fea70 Mon Sep 17 00:00:00 2001 From: cadamsmith Date: Tue, 22 Apr 2025 19:20:54 -0500 Subject: [PATCH 3/3] bump version to 2.4.1 --- .env.cloudflare | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.cloudflare b/.env.cloudflare index 0bc0056..280d3a3 100644 --- a/.env.cloudflare +++ b/.env.cloudflare @@ -1,4 +1,4 @@ VITE_DEPLOY_COMMIT_SHA=$CF_PAGES_COMMIT_SHA VITE_DEPLOY_COMMIT_BRANCH=$CF_PAGES_BRANCH -VITE_APP_VERSION="2.4.0" +VITE_APP_VERSION="2.4.1" diff --git a/package.json b/package.json index 376e085..f0d7e70 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cadamsmith-web", "private": true, - "version": "2.4.0", + "version": "2.4.1", "type": "module", "scripts": { "dev": "vite dev",