UX: Change the timeline date formatting
This commit is contained in:
parent
ee01c275fb
commit
dd036b73bf
|
@ -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) ];
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue