mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-04 09:25:15 +00:00
Show cert expiry date in yellow when < 30 days
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import cn from "classnames";
|
||||
import { isPast, parseISO } from "date-fns";
|
||||
import { differenceInDays, isPast, parseISO } from "date-fns";
|
||||
import { DateTimeFormat } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
value: string;
|
||||
highlightPast?: boolean;
|
||||
highlistNearlyExpired?: boolean;
|
||||
}
|
||||
export function DateFormatter({ value, highlightPast }: Props) {
|
||||
export function DateFormatter({ value, highlightPast, highlistNearlyExpired }: Props) {
|
||||
const dateIsPast = isPast(parseISO(value));
|
||||
const days = differenceInDays(parseISO(value), new Date());
|
||||
const cl = cn({
|
||||
"text-danger": highlightPast && dateIsPast,
|
||||
"text-warning": highlistNearlyExpired && !dateIsPast && days <= 30 && days >= 0,
|
||||
});
|
||||
return <span className={cl}>{DateTimeFormat(value)}</span>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user