Forum Discussion
bojanvelevski
4 years agoValued Contributor
Hi @karthik_dhina,
You can do this by using the ternary operator. Check this out:
$date == null ? Date.now() : $date
This translated means, get me the ‘date’ field, but if it’s null, than get the current datetime. If you want to add current datetime even if the field doesn’t exist, than try the following:
$.get('date') == null ? Date.now() : $date
BR,
Bojan