diff --git a/02_lesson_starter/package-lock.json b/02_lesson_starter/package-lock.json index d52929d..47a5ccb 100644 --- a/02_lesson_starter/package-lock.json +++ b/02_lesson_starter/package-lock.json @@ -9,6 +9,7 @@ "version": "0.1.0", "dependencies": { "@reduxjs/toolkit": "^1.8.0", + "date-fns": "^2.29.3", "prettier": "^2.8.4", "react": "^17.0.2", "react-dom": "^17.0.2", @@ -5656,6 +5657,18 @@ "node": ">=10" } }, + "node_modules/date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -19905,6 +19918,11 @@ "whatwg-url": "^8.0.0" } }, + "date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", diff --git a/02_lesson_starter/package.json b/02_lesson_starter/package.json index 5d20c4a..4992dc7 100644 --- a/02_lesson_starter/package.json +++ b/02_lesson_starter/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@reduxjs/toolkit": "^1.8.0", + "date-fns": "^2.29.3", "prettier": "^2.8.4", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/02_lesson_starter/src/features/posts/PostsList.js b/02_lesson_starter/src/features/posts/PostsList.js index 67964d9..c897da5 100644 --- a/02_lesson_starter/src/features/posts/PostsList.js +++ b/02_lesson_starter/src/features/posts/PostsList.js @@ -1,6 +1,7 @@ import { useSelector } from "react-redux"; import { selectAllPosts } from "./postsSlice"; import PostAuthor from "./PostAuthor"; +import TimeAgo from "./TimeAgo"; const PostsList = () => { const posts = useSelector(selectAllPosts); @@ -11,6 +12,7 @@ const PostsList = () => {
{post.content.substring(0, 100)}