fix post dates
This commit is contained in:
parent
aaef669aa8
commit
6ced08d443
1 changed files with 18 additions and 6 deletions
|
|
@ -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>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue