UX: improve topic timeline date titles (#27351)

This commit is contained in:
Kris 2024-06-06 11:27:12 -04:00 committed by GitHub
parent 46ab4f0c4a
commit dbd16776fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,7 @@
<a
class="start-date"
onClick={{this.updatePercentage}}
title={{this.startDate}}
title={{i18n "topic_entrance.sr_jump_top_button"}}
>
<span>
{{this.startDate}}

View File

@ -193,6 +193,7 @@ export default class TopicTimelineScrollArea extends Component {
get nowDateOptions() {
return {
customTitle: I18n.t("topic_entrance.sr_jump_bottom_button"),
addAgo: true,
defaultFormat: timelineDate,
};

View File

@ -7,6 +7,7 @@ registerRawHelper("age-with-tooltip", ageWithTooltip);
export default function ageWithTooltip(dt, params = {}) {
return htmlSafe(
autoUpdatingRelativeAge(new Date(dt), {
customTitle: params.customTitle,
title: true,
addAgo: params.addAgo || false,
...(params.defaultFormat && { defaultFormat: params.defaultFormat }),

View File

@ -98,7 +98,9 @@ export function autoUpdatingRelativeAge(date, options) {
append += " with-year";
}
if (options.title) {
if (options.customTitle) {
append += "' title='" + options.customTitle;
} else if (options.title) {
append += "' title='" + longDate(date);
}