Skip to content

Commit

Permalink
added formatted date and user first name
Browse files Browse the repository at this point in the history
  • Loading branch information
rajnidua committed Sep 10, 2021
1 parent d8d300c commit c24145f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions utils/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
format_date: (date) => {
// Format date as MM/DD/YYYY
return date.toLocaleDateString();
},

/* get_emoji: () => {
const randomNum = Math.random();
// Return a random emoji
if (randomNum > 0.7) {
return `<span for="img" aria-label="lightbulb">💡</span>`;
} else if (randomNum > 0.4) {
return `<span for="img" aria-label="laptop">💻</span>`;
} else {
return `<span for="img" aria-label="gear">⚙️</span>`;
}
}, */
};
2 changes: 1 addition & 1 deletion views/blogpost.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>fill somethign</p>
<p>{{content}}</p>
<p>{{summary}}</p>
<p>Created by {{author_id}} on {{created_date}}</p>
<p>Created by {{user.fname}} on {{format_date created_date}}</p>
<p>
<span for="img" aria-label="money">💲</span>
<span class="dollar-amount">try</span>
Expand Down
3 changes: 2 additions & 1 deletion views/homepage.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
needed!
</p>
<p>Created by
{{blogpost.author_id}}
{{blogpost.user.fname}}
on
{{format_date created_date}}
</p>
</div>
<div class="col-md-7">
Expand Down

0 comments on commit c24145f

Please sign in to comment.