fix post dates

This commit is contained in:
Nick Pegg 2017-10-14 21:43:26 -07:00
parent aaef669aa8
commit 6ced08d443

View file

@ -58,16 +58,28 @@ class Article extends Component {
return `/${year}/${month}/${slug}`; return `/${year}/${month}/${slug}`;
} }
meta() { date_string() {
// Also should this be hidden for pages? That will require some CSS tweaks let date = new Date(this.props.article.date);
let time_text = "Posted" let year = date.getUTCFullYear();
if (this.props.is_page) { let month = date.getUTCMonth() + 1;
time_text = "Updated" let day = date.getUTCDay() + 1;
if (month < 10) {
month = '0' + month.toString();
} }
if (day < 10) {
day = '0' + day.toString();
}
return `${year}-${month}-${day}`
}
meta() {
let time_text = "Posted";
return ( return (
<div className="post-meta"> <div className="post-meta">
<time>{ time_text } { this.props.article.date }</time> <time>{ time_text } { this.date_string() }</time>
{ this.tags() } { this.tags() }
</div> </div>
); );