feat: highlight expired date and datetime attributes
This commit is contained in:
@@ -32,9 +32,17 @@ const CardAttributesInSummaryItem = ({ cardSummary }: Props) => {
|
||||
|
||||
const isHighlightNeeded = (cardAttr: CardAttributeSchema): boolean => {
|
||||
const type = cardAttr.attribute.type.type;
|
||||
if (type !== "datetime") return false;
|
||||
if (!cardAttr.attribute.isHighlightIfExpired) return false;
|
||||
if (type !== "datetime" && type !== "date") return false;
|
||||
|
||||
const datetime = new Date(cardAttr.value as string);
|
||||
return datetime < new Date();
|
||||
const curr = new Date();
|
||||
if (type === "datetime") {
|
||||
return datetime < curr;
|
||||
}
|
||||
|
||||
curr.setHours(0, 0, 0, 0);
|
||||
return datetime < curr;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user