code: func ParseYear(str string) (int16, error) {
  	v, err := strconv.ParseInt(str, 10, 16)
  	if err != nil {
  		return 0, errors.Trace(err)
  	}
  	y := int16(v)
  
  	if len(str) == 4 {
  		// Nothing to do.
  	} else if len(str) == 2 || len(str) == 1 {
  		y = int16(adjustYear(int(y)))
  	} else {
  		return 0, errors.Trace(ErrInvalidYearFormat)
  	}
  
  	if y < MinYear || y > MaxYear {
  		return 0, errors.Trace(ErrInvalidYearFormat)
  	}
  
  	return y, nil
  }
docs: // ParseYear parses a formatted string and returns a year number.