Files
classroomio/apps/dashboard/src/lib/utils/functions/date.ts
T
Rotimi Best 41e29014ef feat: 🚀 😃 convert repo into a monorepo 🚀 😃 (#51)
* Merge main into turbo-monrepo

* feat: rename apps

* feat: remove supbase videos and serve all from project

* feat: move supabase to root

* feat: update README

* docs: update link
2023-11-25 21:56:02 +00:00

15 lines
416 B
TypeScript

import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
dayjs.extend(relativeTime);
export const calDateDiff = (date: string | number | Date): string => {
return dayjs(date).fromNow(true) + ` ago`;
};
export const getGreeting = () => {
const date = new Date();
const hours = date.getHours();
return hours < 12 ? 'Good Morning' : hours < 18 ? 'Good Afternoon' : 'Good Evening';
};