I'm building a calendar application where users can save events that recur.
After a lot of research I've chosen to use the moment-recur plugin to the moment.js library to save the dates of recurring events in the database.
My issue is: users in my application will frequently wish to set an event to repeat at the end of a financial quarter.
In the UK these are 31st March, 30th June, 30th September and 31st December.
I can't work out a way to implement this functionality. If I set the recurrence to be '3 months' like this:
let recurring = moment(date).recur().every(3, 'months');
If the begin date is 31/03/2016
then it will skip June altogether as there are only 30 days in June.
If the begin date is 30/06/2016
then it won't work for the quarters that end on the 31st.
Any advice is much appreciated!