Calculate my age starting from my date of birth and comparing it to today's date

{
  "Name": "test-birthday",
  "CreationDate": "2019-10-11",
  "Commands": [
    {
      "Command": "store",
      "Target": "1995/05/15",
      "Value": "birthday"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "function getAge(dateString) {var today = new Date();var birthDate = new Date(dateString);var age = today.getFullYear() - birthDate.getFullYear();var m = today.getMonth() - birthDate.getMonth();if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())){age--;}return age;}return getAge(${birthday});",
      "Value": "age"
    },
    {
      "Command": "echo",
      "Target": "${age}",
      "Value": ""
    }
  ]
}
2 Likes