Skip to content

Commit

Permalink
Add support for hovering over some dates to see the non-recent day
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 committed Mar 26, 2024
1 parent fff2f32 commit 1bb9437
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Plan/react/dashboard/src/components/navigation/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Header = ({page, tab, hideUpdater}) => {
</button>}
{staticSite && <Fa icon={faClockRotateLeft} title={t('html.label.exported')}/>}
{' '}
<span className="refresh-time"><FormattedDate date={lastUpdate.date}/></span>
<span className="refresh-time"><FormattedDate date={lastUpdate.date} react/></span>
</div>
</>}

Expand Down
8 changes: 7 additions & 1 deletion Plan/react/dashboard/src/components/text/FormattedDate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ export function formatDate(date, offset, pattern, recentDays, recentDaysPattern,
return date !== 0 ? new SimpleDateFormat(format).format(timestamp) : '-'
}

const FormattedDate = ({date}) => {
const FormattedDate = ({date, react}) => {
const {t} = useTranslation();

const {pattern, recentDays, recentDaysPattern, offset} = useDatePreferences();

if (!pattern || date === undefined || date === null) return <></>;
if (!isNumber(date)) return date;

if (react) {
return <span title={formatDate(date, offset, pattern, false, null, t)}>
{formatDate(date, offset, pattern, recentDays, recentDaysPattern, t)}
</span>
}

return formatDate(date, offset, pattern, recentDays, recentDaysPattern, t);
};

Expand Down

0 comments on commit 1bb9437

Please sign in to comment.