Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. const getToday = () => {
  2. const d = new Date();
  3. const year = d.getFullYear();
  4. const month = () => {
  5. if((d.getMonth() + 1).length === 1) {
  6. return d.getMonth() + 1;
  7. }
  8. else {
  9. return '0' + (d.getMonth() + 1)
  10. }
  11. };
  12. const day = d.getDate();
  13. const today = `${year}-${month()}-${day}`;
  14. return today;
  15. };
  16. const today = getToday();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement