What are the potential security risks of using JavaScript to display time-sensitive text on a webpage?

Using JavaScript to display time-sensitive text on a webpage can potentially expose sensitive information to malicious users if the JavaScript code is not secure. To mitigate this risk, it is recommended to use server-side scripting languages like PHP to handle time-sensitive operations and only use JavaScript for client-side interactions.

<?php
$current_time = time();
$expiration_time = strtotime('2023-01-01 00:00:00'); // Set the expiration time

if($current_time < $expiration_time){
    echo "Time-sensitive text here";
} else {
    echo "Text has expired";
}
?>