Add support for hovering over some dates to see the non-recent day
This commit is contained in:
parent
fff2f329a7
commit
1bb9437ed2
|
@ -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>
|
||||
</>}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ 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();
|
||||
|
@ -48,6 +48,12 @@ const FormattedDate = ({date}) => {
|
|||
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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue