Date Question Optional Ranges

## Who created this

- @karlentwistle 
- @FriedSock 

## Agile Planner Ticket

[Date question range inconsistent with SA](https://www.agileplannerapp.com/boards/105200/cards/8703)

## How do I use this

To control the range of years selected you can supply 2 optional arguments to date questions: `from` and `to`.
These can take the form of absolute values, eg.

```markdown
[date: baby_due_date, from: 2010, to: 2015]
```

Or relative values (from the current year), eg.

```markdown
[date: baby_due_date, from: -4, to: 1]
```

The default values for `from` and `to` are relative years: `-1` and `3` respectively.

## How do I test this

1) Edit the Gemfile in smart-answers so that it uses a local version of smartdown based on the path. By default in the GDS VM this is /var/govuk/smartdown

````
#if ENV['SMARTDOWN_DEV']
  gem 'smartdown', :path => '../smartdown'
#else
#  gem 'smartdown', '0.8.2'
#end
````

2) Checkout this branch (date_question) in smartdown
3) Bundle!!!
4) bowl smart-answers
5) Edit one of the example smartdown_flows animal-example-multiple or animal-example-simple with a syntax error. I used question_4.txt in  animal-example-simple

````
# That's not a cat!!

[date: thing, from: 2011, to: 2040]

# Go back and do not collect $200 and get rid of bulldog

[choice: question_1, alias: type_of_feline]
* lion: Lion
* tiger: Tiger
* cat: Cat
* sphynx: Sphynx
* meowth: Meowth

* type_of_feline in {lion tiger cat} => question_2
* type_of_feline is 'meowth' => question_5
* otherwise => outcome_safe_pet
````

Now navigate to the flow and check that the year for selection changes to what you're expecting.

We cant use alias, its a reserved word in Ruby.