Skip to content

Commit bc2838e

Browse files
author
David Leger
committed
fix: present date display
1 parent b556c9c commit bc2838e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/Card/Card.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ import Prose from '../Prose/Prose';
77
import { Props as Tag } from '../Tag';
88
import { TagList } from '../TagList';
99
const Time = (props: { value: Date }) => {
10+
const currentDate = new Date(Date.now());
11+
const isCurrent =
12+
props.value.getMonth() === currentDate.getMonth() &&
13+
props.value.getFullYear() === currentDate.getFullYear();
1014
const formattedValue = formatDate(props.value);
1115
const stringValue = props.value.toDateString();
12-
return <time dateTime={stringValue}>{formattedValue}</time>;
16+
return (
17+
<time dateTime={stringValue}>{isCurrent ? 'Present' : formattedValue}</time>
18+
);
1319
};
1420

1521
const Duration = (props: { start: Date; end: Date }) => (

0 commit comments

Comments
 (0)