I am beginner using bootstrap PDO and php. javascript How can I compare 2 date like image below.

I am beginner using bootstrap PDO and php. javascript How can I compare 2 date like image below.

It depens on when/where u want to compare them. While filling out the form will require JS/Jquery. After submitting requires PHP.
In PHP it should work like this:
$date1 = "2022-02-02";
$date2 = "2021-01-01";
$dateTime1 = strtotime($date1);
$dateTime2 = strtotime($date2);
if ($dateTime1 > $dateTime2){
echo "$date1 is latest than $date2";
}else{
echo "$date1 is older than $date2";
}
PHP manual strtotime().
For JQuery use this thread.