```
let time = args.shift();
let timeUnit = time.split('').pop();
if (timeUnit === 'd') timeUnit = 86400;
else if  (timeUnit === 'h') timeUnit = 3600;
else if (timeUnit === 'm') timeUnit = 60;
else {
    time.push(timeUnit);
    timeUnit = 1;
}
time *= timeUnit *= 1000;

var endingTime = new Date();
endingTime.setTime(endingTime.getTime() + time);
console.log(endingTime);

// When I type in _gcreate (the command) 1d it says the error:
// Invalid Date
// Even though I tell it to add milliseconds and whatnot.

```

I am creating a bot for giveaways on Discord.JS. It throws the error `Invalid Date`.