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) {
      return 'Unable to determine the time of year!'
    }
  
    if (!isValidDate(date)) {
      throw new Error('Invalid date!');
    }
  
    const month = date.getMonth()
  
    if (month === 11 || month < 2) {
      return 'winter';
    }
  
    if (month < 5) {
      return 'spring';
    }
  
    if (month < 8) {
      return 'summer';
    }
  
    if (month < 11) {
      return 'autumn';
    }
  }
  
  
  function isValidDate(date) {
    if (!(date instanceof Date)) {
      return false
    }
  
    if (date[Symbol.toStringTag] === 'Date') {
      return false
    }
  
    return true
  }