Skip to content

Commit

Permalink
refactor(date): rename Date component DateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
rbardini committed Sep 9, 2024
1 parent 8b395a9 commit 425ac81
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions components/awards.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html } from '@rbardini/html'
import markdown from '../utils/markdown.js'
import Date from './date.js'
import DateTime from './date-time.js'

/**
* @param {import('../schema.d.ts').ResumeSchema['awards']} awards
Expand All @@ -19,7 +19,7 @@ export default function Awards(awards = []) {
<header>
<h4>${title}</h4>
<div class="meta">
${awarder && html`<div>Awarded by <strong>${awarder}</strong></div>`} ${date && Date(date)}
${awarder && html`<div>Awarded by <strong>${awarder}</strong></div>`} ${date && DateTime(date)}
</div>
</header>
${summary && markdown(summary)}
Expand Down
4 changes: 2 additions & 2 deletions components/certificates.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html } from '@rbardini/html'
import Date from './date.js'
import DateTime from './date-time.js'
import Link from './link.js'

/**
Expand All @@ -19,7 +19,7 @@ export default function Certificates(certificates = []) {
<header>
<h4>${Link(url, name)}</h4>
<div class="meta">
${issuer && html`<div>Issued by <strong>${issuer}</strong></div>`} ${date && Date(date)}
${issuer && html`<div>Issued by <strong>${issuer}</strong></div>`} ${date && DateTime(date)}
</div>
</header>
</article>
Expand Down
2 changes: 1 addition & 1 deletion components/date.js → components/date-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const formatDate = dateString =>
* @param {string} date
* @returns {string}
*/
export default function Duration(date) {
export default function DateTime(date) {
return html`<time datetime="${date}">${formatDate(date)}</time>`
}
6 changes: 3 additions & 3 deletions components/duration.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { html } from '@rbardini/html'
import Date from './date.js'
import DateTime from './date-time.js'

/**
* @param {string} startDate
* @param {string} [endDate]
* @returns {string}
*/
export default function Duration(startDate, endDate) {
if (endDate === startDate) return Date(endDate)
return html`<time-duration>${Date(startDate)}${endDate ? Date(endDate) : 'Present'}</time-duration>`
if (endDate === startDate) return DateTime(endDate)
return html`<time-duration>${DateTime(startDate)}${endDate ? DateTime(endDate) : 'Present'}</time-duration>`
}
4 changes: 2 additions & 2 deletions components/publications.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html } from '@rbardini/html'
import markdown from '../utils/markdown.js'
import Date from './date.js'
import DateTime from './date-time.js'
import Link from './link.js'

/**
Expand All @@ -21,7 +21,7 @@ export default function Publications(publications = []) {
<h4>${Link(url, name)}</h4>
<div class="meta">
${publisher && html`<div>Published by <strong>${publisher}</strong></div>`}
${releaseDate && Date(releaseDate)}
${releaseDate && DateTime(releaseDate)}
</div>
</header>
${summary && markdown(summary)}
Expand Down

0 comments on commit 425ac81

Please sign in to comment.