UX: Make the timeline dates the same format

This commit is contained in:
Robin Ward 2016-05-25 12:42:25 -04:00
parent 66b63b94de
commit e5ad297ef0
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
2 changed files with 8 additions and 8 deletions

View File

@ -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', {
tagName: 'div.timeline-scroller',
@ -46,11 +51,7 @@ createWidget('timeline-scroller', {
];
if (date) {
const format = (date.getFullYear() === new Date().getFullYear()) ?
'long_no_year_no_time' :
'timeline_diff_year';
contents.push(h('div.timeline-ago', moment(date).format(I18n.t(`dates.${format}`))));
contents.push(h('div.timeline-ago', timelineDate(date)));
}
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),
this.attach('link', {
className: 'start-date',
rawLabel: moment(createdAt).format(I18n.t('dates.timeline_start')),
rawLabel: timelineDate(createdAt),
action: 'jumpTop'
}),
this.attach('timeline-scrollarea', attrs),

View File

@ -36,8 +36,7 @@ en:
millions: "{{number}}M"
dates:
time: "h:mm a"
timeline_start: "MMMM YYYY"
timeline_diff_year: "MMM YYYY"
timeline_date: "MMM YYYY"
long_no_year: "MMM D h:mm a"
long_no_year_no_time: "MMM D"
full_no_year_no_time: "MMMM Do"