Send Mail from an AMP page

In one of my projects I embedded Google's new open-source initiative, AMP(Accelerated Mobil Pages). It was a WordPress website. I was all done with most of the part of website, however there was still a module which needs research i.e. implementing contact form into website.

While, we implementing any form in a website, we need to add validations as well as the data-handler scripts. So, I had two problems to resolve on:

Calculate Fortnight Date

The following code will calculate a recurring fortnightly date from a given date, i.e. a star-date. The date format should be 'Y-m-d' for the following code. However, you can make updates in it as per requirements.

For example: The start date for the fortnight cycle date was set to be as "2018-01-10". Then, as per current cycle, next will be 2018-02-20.

Select an element by name with jQuery

You can use the attribute selector for selecting an element with its name.
For example if you have to select input with its name.