If function with a time picker issue

HI

Im struggling to get my if function working, when the client fills out the form and forget to fill out this time picker i want it to return the message.

else if ($w("meal1timePicker").selectedIndex !== undefined) {

Only the section after the string is the issue the value part

($w("meal1timePicker"). "Something something here

Works for all other types of boxes no issues but for the time picker it seems to want something else to make it work?

 function checkMealplan() {

 if($w("#emailClientrichText").value == "") {
            $w("#validationMessagetext").text = "Hi! you need to fill out the comments to the client on slide 1"
            $w("#validationMessagetext").show("fade",fadeOption)}
 
 else if ($w("meal1timePicker").selectedIndex !== undefined) {
            $w("#validationMessagetext").show("puff",puffOption)
            $w("#validationMessagetext").text = "No time set in meal 1!";}

 else if ($w("#mealTypedropdown").value == "") {
            $w("#validationMessagetext").show("puff",puffOption)
            $w("#validationMessagetext").text = "No meal type set in meal 1!";}

 else {
         $w("#validationMessagetext").text = "Check completed & all fields are good & data will be now be submitted!";
         console.log("Check completed & all fields are good & data will be now be submitted!")// If FALSE what to do 
 }
 }

I’ve tried many different variations none seem to work. including these

else if ($w("meal1timePicker").value !== '') {
else if ($w("meal1timePicker").value.length < 1) {

Any ideas?

Thanks

Dan

Solved the issue i linked my submit button to a function to check the meals before submission that seemed to be causing the error for some reason.

elseif($w("meal1timePicker").value.length <1){

this always seems to work best for me for validating elements before a submission is sent to collection