top of page

You are "0" years old

$w.onReady(() => {

    $w("#DOBPicker").onChange(() => {

 

        var todaysDate = new Date().getFullYear();// CURRENT YEAR

 

        let inputDate = $w("#DOBPicker").value;//VALUE FROM DATE PICKER

        var inputDateyear = inputDate.getFullYear();//YEAR PICKED FROM DATE PICKER

 

        $w("#ageDisplay").show();//SHOW TEXT AFTER PICKING A DATE (OPTIONAL)

 

        $w("#ageDisplay").text = `You are "${String(todaysDate - Number(inputDateyear))}" years old`; //DESIGN YOUR MESSAGE

 

    })

})

Copied!

bottom of page