Date Validation

Easy
6
72.7% Acceptance

Create a Python function named validate_date that takes a string date in the format 'dd-mm-yyyy' and determines if it's a valid date in the Gregorian calendar. It should return:

  • 'today' if the date is the current date.
  • 'past' if the date is in the past.
  • 'future' if the date is in the future.
  • Raise a ValueError for invalid dates or formats.

Requirements

  • Function name: validate_date
  • Input: A string representing a date in 'dd-mm-yyyy' format.
  • Output: A string ('today', 'past', 'future') or a ValueError.

Examples

  • validate_date('12-11-2023') should return 'future' if today's date is before 12th November 2023.
  • validate_date('01-01-2000') should return 'past'.

Ensure your function handles all scenarios correctly and passes the provided challenges.

TIP: Make use of the datetime module available in Python