revert to previous implementation, but make it cleaner

This commit is contained in:
Filip Danić
2018-10-17 21:37:54 +02:00
parent 1e43dc7b89
commit ab44e065d9

View File

@ -1,7 +1,10 @@
const tomorrow = () => {
let t = new Date();
const t = new Date();
t.setDate(t.getDate() + 1);
return t.toISOString().split('T')[0];
const year = t.getFullYear();
const month = String(t.getMonth() + 1).padStart(2, '0');
const date = String(t.getDate()).padStart(2, '0');
return `${year}-${month}-${date}`;
};
module.exports = tomorrow;