Skip to content

Commit 3d5d933

Browse files
authored
Merge pull request #20 from citomcclure/issue/#19-job-listings-do-not-display-date-posted
Display date on job listing
2 parents 8adbed6 + 0de0ac2 commit 3d5d933

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/jobs/JobListing.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="salary-info">
1010
<b-badge v-if="job.salary_min > 0" class="salary-badge">{{ salary }}</b-badge>
1111
</div>
12-
<p class="subtitle">Posted at </p>
12+
<p class="subtitle">Posted {{ formattedDate }}</p>
1313

1414

1515
<!-- Render the description with markup support -->
@@ -51,6 +51,17 @@ export default defineComponent({
5151
}
5252
},
5353
computed: {
54+
formattedDate() {
55+
const job = this.job
56+
if (job.created != null) {
57+
const date = new Date(job.created)
58+
return new Intl.DateTimeFormat('en-US', {
59+
dateStyle: "medium"
60+
}).format(date)
61+
} else {
62+
return ''
63+
}
64+
},
5465
salary() {
5566
const j = this.job
5667
if (j.salary_max != null && j.salary_min != null) {

0 commit comments

Comments
 (0)