mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 20:08:26 +00:00
UX: Make the timeline dates the same format
This commit is contained in:
parent
66b63b94de
commit
e5ad297ef0
@ -31,6 +31,11 @@ createWidget('timeline-last-read', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function timelineDate(date) {
|
||||||
|
const fmt = (date.getFullYear() === new Date().getFullYear()) ? 'long_no_year_no_time' : 'timeline_date';
|
||||||
|
return moment(date).format(I18n.t(`dates.${fmt}`));
|
||||||
|
}
|
||||||
|
|
||||||
createWidget('timeline-scroller', {
|
createWidget('timeline-scroller', {
|
||||||
tagName: 'div.timeline-scroller',
|
tagName: 'div.timeline-scroller',
|
||||||
|
|
||||||
@ -46,11 +51,7 @@ createWidget('timeline-scroller', {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (date) {
|
if (date) {
|
||||||
const format = (date.getFullYear() === new Date().getFullYear()) ?
|
contents.push(h('div.timeline-ago', timelineDate(date)));
|
||||||
'long_no_year_no_time' :
|
|
||||||
'timeline_diff_year';
|
|
||||||
|
|
||||||
contents.push(h('div.timeline-ago', moment(date).format(I18n.t(`dates.${format}`))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [ h('div.timeline-handle'), h('div.timeline-scroller-content', contents) ];
|
return [ h('div.timeline-handle'), h('div.timeline-scroller-content', contents) ];
|
||||||
@ -230,7 +231,7 @@ export default createWidget('topic-timeline', {
|
|||||||
return [ h('div.timeline-controls', controls),
|
return [ h('div.timeline-controls', controls),
|
||||||
this.attach('link', {
|
this.attach('link', {
|
||||||
className: 'start-date',
|
className: 'start-date',
|
||||||
rawLabel: moment(createdAt).format(I18n.t('dates.timeline_start')),
|
rawLabel: timelineDate(createdAt),
|
||||||
action: 'jumpTop'
|
action: 'jumpTop'
|
||||||
}),
|
}),
|
||||||
this.attach('timeline-scrollarea', attrs),
|
this.attach('timeline-scrollarea', attrs),
|
||||||
|
@ -36,8 +36,7 @@ en:
|
|||||||
millions: "{{number}}M"
|
millions: "{{number}}M"
|
||||||
dates:
|
dates:
|
||||||
time: "h:mm a"
|
time: "h:mm a"
|
||||||
timeline_start: "MMMM YYYY"
|
timeline_date: "MMM YYYY"
|
||||||
timeline_diff_year: "MMM YYYY"
|
|
||||||
long_no_year: "MMM D h:mm a"
|
long_no_year: "MMM D h:mm a"
|
||||||
long_no_year_no_time: "MMM D"
|
long_no_year_no_time: "MMM D"
|
||||||
full_no_year_no_time: "MMMM Do"
|
full_no_year_no_time: "MMMM Do"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user