Share your answers as Markdown through Gist and include code as Markdown code blocks. No worries, there is more than one way to answer the questions 👍
Write a function (without using external libraries) in ES6 that converts the user entered date formatted as
M/D/YYYY to the format
YYYYMMDD which is required by an API endpoint. It should convert
”20161231” for example. Furthermore, it should validate that the passed date is formatted correctly using a Regular Expression (let's assume all months have 31 days). Write unit tests for your convert function using the syntax of a BDD-style test framework of your choice.