I was wondering if anybody can help me in creating the right future month end date in the DB starting from any initial date. Let me try to better explain it.
In my application users can create new cash flow forecasts starting from a month end date of their choice. The input is the starting date (from a list or calendar, does not matter) and there is a “CREATE” button. When the button is clicked I run a backend workflow that creates a number of rows (usually 6) in the “forecast periods” table. What I do is to pass the starting date in the backend workflow and create a new thing with the “end date” equal to starting date + month: 1, starting date + month: 2, starting date + month: 3, and so on.
What happen is this. When the starting date is the last day of a month with 31 days, there are no problems since Bubble take care of adjusting the ending date to the last date of the month. So, if for instance the start date is January 31, 2020, the first forecast period calculated as January 31 2020 + month:1 is not February 31 2020 but February 29, 2020. Correct.
But when the starting date is, let’s say, the 30th of a month, what happens is that all the future dates created by the backend workflow are not the end of the corresponding month but are the 30th of the month. For instance, if the starting date is June 30, 2020 the first forecast period will be July 30, 2020. The problem is that I alway need to save the last day of the month. In the example, I need to save July 31, 2020.
Any idea about how to tell Bubble “create a new date as this date plus month X and set the date as the last day of the month” ? Thank you so much for any input.