mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
Address PR comments
This commit is contained in:
@@ -78,17 +78,11 @@ function RssTile({ widget }: RssTileProps) {
|
|||||||
const inputDate = dayjs(new Date(input));
|
const inputDate = dayjs(new Date(input));
|
||||||
const now = dayjs(); // Current date and time
|
const now = dayjs(); // Current date and time
|
||||||
|
|
||||||
const diffInHours = now.diff(inputDate, 'hour');
|
// The difference between the input date and now
|
||||||
const diffInDays = now.diff(inputDate, 'day');
|
const difference = now.diff(inputDate, 'ms');
|
||||||
|
const duration = dayjs.duration(difference, 'ms');
|
||||||
// If the input date is more than 2 weeks ago, return the formatted date
|
const humanizedDuration = duration.humanize();
|
||||||
if (diffInDays > 14) {
|
return `${humanizedDuration} ago`;
|
||||||
return inputDate.format('DD MMM YYYY');
|
|
||||||
}
|
|
||||||
if (diffInDays >= 1) {
|
|
||||||
return `${diffInDays} days ago`;
|
|
||||||
}
|
|
||||||
return `${diffInHours} hours ago`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data || isLoading) {
|
if (!data || isLoading) {
|
||||||
|
|||||||
Reference in New Issue
Block a user