SHARE
TWEET

Untitled

a guest Nov 9th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function daysAfterBirth([arg1]){
  2.     let input = arg1;
  3.     let inputArray = arg1.split('-');
  4.     let day = inputArray[0];
  5.     let month = inputArray[1];
  6.     let year = inputArray[2];
  7.     let birthdate = `${year}-${month}-${day}`
  8.     let newdate = new Date(birthdate);
  9.     newdate.setUTCDate((newdate.getDate())+1000);
  10.     let dayOutput = newdate.getDate();
  11.     let monthOutput = newdate.getMonth()+1;
  12.     let yearOutput = newdate.getFullYear();
  13.     newdate = (`${dayOutput}-${monthOutput}-${yearOutput}`);
  14.     if (monthOutput<10){
  15.         month ="0"+month;
  16.     }if (dayOutput<10){
  17.         day ="0"+day;
  18.     }
  19.     console.log(newdate)
  20. }
  21. daysAfterBirth(["25-02-1995"])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top