Skip to content

Commit

Permalink
✨ Adjusted the publishing date of the note
Browse files Browse the repository at this point in the history
  • Loading branch information
EdTonatto committed Jul 3, 2023
1 parent 1559e71 commit c995184
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import styles from './App.module.css'
import { Sidebar } from './components/Sidebar'
import { Game } from './components/Game'

const now = new Date();

const games = [
{
id: 1,
Expand All @@ -20,7 +22,7 @@ const games = [
{order: 3, type: 'P', content: 'My actual playtime is about 20 hours and 65% complete.'},
{order: 4, type: 'P', content: '10/10 game'},
],
publishedAt: new Date('2023-07-02 19:45:00')
publishedAt: new Date(now.setMinutes(now.getMinutes() - 25)),
},
{
id: 2,
Expand All @@ -31,7 +33,7 @@ const games = [
publisher: 'Published by Poncle'
},
content: [],
publishedAt: new Date('2023-07-02 19:00:00')
publishedAt: new Date(now.setHours(now.getHours() - 5))
},
{
id: 3,
Expand All @@ -42,7 +44,7 @@ const games = [
publisher: 'Published by Valve'
},
content: [],
publishedAt: new Date('2023-07-01 12:00:00')
publishedAt: new Date(now.setDate(now.getDate() - 2))
},
{
id: 4,
Expand All @@ -53,7 +55,18 @@ const games = [
publisher: 'Published by Xbox Game Studios'
},
content: [],
publishedAt: new Date('2023-06-15 00:00:00')
publishedAt: new Date(now.setMonth(now.getMonth() - 1))
},
{
id: 5,
game: {
name: "Red Dead Redemption 2",
coverImg: "https://howlongtobeat.com/games/27100_Red_Dead_Redemption_2.jpg?width=250",
releaseDate: new Date('2018-10-26 00:00:00'),
publisher: 'Published by Rockstar Games'
},
content: [],
publishedAt: new Date(now.setFullYear(now.getFullYear() - 1))
}
]

Expand Down
2 changes: 1 addition & 1 deletion src/components/Game.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './Game.module.css';

export function Game({ game, content, publishedAt }) {
const releaseDate = format(game.releaseDate, "dd LLL',' yyyy");
const publishedDate = format(publishedAt, "dd LLL");
const publishedDate = format(publishedAt, "dd LLL',' yy");
const publishedDateToNow = formatDistanceToNow(publishedAt, { addSuffix: true });

return (
Expand Down

0 comments on commit c995184

Please sign in to comment.