Changeset 08f82ec for jobvista-frontend/src/utils
- Timestamp:
- 06/20/24 11:57:13 (5 months ago)
- Branches:
- main
- Children:
- 0f0add0
- Parents:
- befb988
- Location:
- jobvista-frontend/src/utils
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
jobvista-frontend/src/utils/utils.js
rbefb988 r08f82ec 7 7 } 8 8 9 export const sortElementsBySubmissionDate = (array) => {10 return array.slice().sort((a, b) => {11 return new Date(b).getTime() - new Date(a.postedOn).getTime()12 });13 }14 15 9 export const formatRelativeTime = (dateString) => { 16 10 const date = new Date(dateString); … … 18 12 const diffTime = now - date; 19 13 20 // Define time intervals in milliseconds21 14 const minute = 60 * 1000; 22 15 const hour = minute * 60; … … 25 18 const month = day * 30; 26 19 27 // Calculate the relative time28 20 if (diffTime < minute) { 29 21 return 'just now';
Note:
See TracChangeset
for help on using the changeset viewer.