Infosys interview question

Write a script to restrict users from selecting future dates from date/time type field.