UX: Change the timeline date formatting

This commit is contained in:
Robin Ward 2016-05-20 16:30:47 -04:00
parent ee01c275fb
commit dd036b73bf
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { createWidget } from 'discourse/widgets/widget'; import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom'; import { h } from 'virtual-dom';
import { smartShortDate, relativeAge } from 'discourse/lib/formatter'; import { relativeAge } from 'discourse/lib/formatter';
import { iconNode } from 'discourse/helpers/fa-icon'; import { iconNode } from 'discourse/helpers/fa-icon';
const SCROLLAREA_HEIGHT = 300; const SCROLLAREA_HEIGHT = 300;
@ -47,7 +47,11 @@ createWidget('timeline-scroller', {
]; ];
if (date) { if (date) {
contents.push(h('div.timeline-ago', smartShortDate(date))); const format = (date.getFullYear() === new Date().getFullYear()) ?
'long_no_year_no_time' :
'long_with_year_no_time';
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) ];

View File

@ -59,6 +59,10 @@
padding-left: 1em; padding-left: 1em;
} }
.timeline-ago {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
}
.timeline-scroller { .timeline-scroller {
@include unselectable; @include unselectable;
margin-left: -0.18em; margin-left: -0.18em;