text: import { NotImplementedError } from "../extensions/index.js";
  
  /**
   * Extract season from given date and expose the enemy scout!
   *
   * @param {Date | FakeDate} date real or fake date
   * @returns {String} time of the year
   *
   * @example
   *
   * getSeason(new Date(2020, 02, 31)) => 'spring'
   *
   */
  export default function getSeason(date) {
    if (date instanceof Date && !isNaN(date.valueOf())) {
      let month = date.getMonth();
      if (month >= 2 && month <= 4) {
        return "spring";
      } else if (month >= 5 && month <= 7) {
        return "summer";
      } else if (month >= 8 && month <= 10) {
        return "autumn";
      } else {
        return "winter";
      }
    } else {
      if (date == null) {
        return "Invalid date!";
      }
      throw new Error("Invalid date!");
    }
  }
  