Zero-pad months < 10
This is greasy, but it doesn't look like JS has a sprintf-alike
This commit is contained in:
parent
b696005d89
commit
e22f52b06d
1 changed files with 4 additions and 0 deletions
|
|
@ -46,6 +46,10 @@ class Article extends Component {
|
||||||
let year = date.getUTCFullYear();
|
let year = date.getUTCFullYear();
|
||||||
let month = date.getUTCMonth() + 1;
|
let month = date.getUTCMonth() + 1;
|
||||||
|
|
||||||
|
if (month < 10) {
|
||||||
|
month = '0' + month.toString();
|
||||||
|
}
|
||||||
|
|
||||||
let slug = this.props.article.slug;
|
let slug = this.props.article.slug;
|
||||||
if (!slug) {
|
if (!slug) {
|
||||||
slug = slugify(this.props.article.title);
|
slug = slugify(this.props.article.title);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue