Updates date style on tasks page (#1244)
* updates date style on tasks page * re-run tests
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { differenceInCalendarDays, formatDistanceToNow } from 'date-fns';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { logError } from './logError';
|
||||
@ -88,3 +88,19 @@ export function beautifyPastDateAbsolute(pastDate: Date | string | number) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function hasDatePassed(date: Date | string | number) {
|
||||
try {
|
||||
const parsedDate = parseDate(date);
|
||||
|
||||
return (
|
||||
differenceInCalendarDays(
|
||||
DateTime.local().toJSDate(),
|
||||
parsedDate.toJSDate(),
|
||||
) >= 1
|
||||
);
|
||||
} catch (error) {
|
||||
logError(error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user