Inputs with Start Date and End Date of the current month
Question

Hello Guys!

I am developing a Web App and on a page show through a Table Records the type of expense and the sum of these expenses for a certain period that the user can put. Ok, it's working! But....

I want to show the situation of the current month, that is, I would like the inputs "InitialDate" and "FinalDate" to be filled respectively with the first and last days of the current month. From that point I froze.

If we are on September and CurrDate() for example would be: 2019-09-25 would automatically recognize that September InitialDate is 2019-09-01 and September FinalDate is 2019-09-30. How i do it?

Should be create a button next to "Clear Button" to fill in the input through an action?

Or is it easier for the page to start already with the information filled in?

I can't think of how I extract month information from CurrDate () knowing that each month ends with a different day. Maybe it's easier than I think.

InputDate.png

mvp_badge
MVP
Solution

Hi André,

Here are the formulas to use:

Last day of currrent month: AddDays( AddMonths( NewDate( Year(Date), Month(Date), 1 ), 1 ), -1 )

First day of current month: NewDate( Year(Date), Month(Date), 1)

I would advice you make two server actions that have a Date type input, and a Date type output.

Set the IsFunction to true. Then you can use them in expressions.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi André,

Here are the formulas to use:

Last day of currrent month: AddDays( AddMonths( NewDate( Year(Date), Month(Date), 1 ), 1 ), -1 )

First day of current month: NewDate( Year(Date), Month(Date), 1)

I would advice you make two server actions that have a Date type input, and a Date type output.

Set the IsFunction to true. Then you can use them in expressions.

Regards,

Daniel

Hi Daniel,
I will do it that way.
Thank's for your time!


mvp_badge
MVP

Your welcome

Daniël Kuhlmann wrote:

Your welcome

I followed your directions and it worked! Thanks

I am sending the solution image to help those who have the same question.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.