In this challenge you have to calculate the moon's phase for a given date.


This challenge is inspired by the <s>game</s> *psycho social audiovisual experiment* "[Superbrothers: Sword & Sworcery EP](https://vimeo.com/20379529)". In *S:S&S EP* the moon's phases are important to the outcome of the adventure as some events occur only at a specific point in time.

<img src="http://i.stack.imgur.com/iKH9q.jpg" alt="Screenshot from Superbrothers: Sword & Sworcery EP">

<sub>Mild game spoilers ahead:</sub>

>! Besides the intended way of putting your device aside until a certain phase is reached, you can also manipulate the phase in a secret place called "*The Moon Grotto*". Or you can cheat and change the date setting of your device. Keep in mind that cheating is penalized though.

Now, we want to know which lunar phase is present on a specific date. Each main phase – new moon, first quarter, full moon, third quarter – is about 7.38 days long. The whole lunar cycle is roughly 29.52 days. Based on these values various methods of calculation exist.<sup>1</sup>


- A date based on the Gregorian calendar, between 1 January 1970 and 31 December 2116.
- You can choose one of the following formats: `yyyy-mm-dd`, `dd.mm.yyyy`, `dd/mm/yyyy`, `yyyymmdd` or `ddmmyyyy`.


Output the index `[0-7]` of the lunar phase based on this zero-indexed array:

    ['New moon', 'Waxing crescent', 'First quarter', 'Waxing gibbous', 'Full moon', 'Waning gibbous', 'Third quarter', 'Waning crescent`]


- You can write a program or a function. If you go with an anonymous function, please include an example of how to invoke it.
- Input is accepted from `STDIN`, command line arguments, as function parameters or from the closest equivalent.
- This is [tag:code-golf] so shortest answer in bytes wins.
- Built-ins or external libraries are not allowed.<sup>2</sup>
- Standard loopholes are disallowed.


    14.12.2016 | 4 | Full moon
    28.01.2016 | 5 | Waning gibbous
    19.01.2016 | 3 | Waxing gibbous
    17.01.2016 | 2 | First quarter
    12.01.2016 | 1 | Waxing crescent
    24.01.2016 | 4 | Full moon
    11.08.1999 | 0 | New moon
    16.10.1983 | 3 | Waxing gibbous
    04.07.1976 | 2 | First quarter
    29.11.1970 | 0 | New moon


Reduce your byte count and *withdraw*:

- **15%** – Print the actual name of the phase as listed in section **Output** instead of its index.
- **25%** – Print the dates of the upcoming new and full moon separated by a whitespace or newline on empty input.


<sub><sup>1</sup> For example: [Calculating phase](https://en.wikipedia.org/wiki/Lunar_phase#Calculating_phase) on Wikipedia.<br>
<sub><sup>2</sup> Sorry [Mathematica](https://reference.wolfram.com/language/ref/MoonPhase.html).