0

I have a function call getPassportExpiryDate:

     function getPassportExpiryDate() {
         return new Date(2019, 8, 17);
      }

I want (2019, 8, 17) to be dynamic instead of static date, according to the current date.

bita
  • 335
  • 2
  • 9
  • 22

2 Answers2

3

Just call new Date(), don't pass anything inside your Date object.

arjayosma
  • 540
  • 3
  • 15
0

function getPassportExpiryDate() {
  return new Date();
}
console.log(getPassportExpiryDate())
holydragon
  • 6,158
  • 6
  • 39
  • 62