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
  • 315
  • 7
  • 20

2 Answers2

3

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

arjayosma
  • 530
  • 3
  • 15
0

function getPassportExpiryDate() {
  return new Date();
}
console.log(getPassportExpiryDate())
holydragon
  • 4,911
  • 4
  • 30
  • 45