How to Create a Wappler Server Action to Save Multiple Days of Data to MySQL

You can easily determine the number of days in a month by creating a custom formatter.

Make sure the moment.js framework is added on the page:

Then add this code in the head tags, just before the closing </head> tag:

<script>
    dmx.Formatter('string', 'monthDays', function(val, format) {
        const date = moment(val, 'MMMMYYYY');
        return date.daysInMonth();
    });
</script>

On the page you can then use:

{{query.month.monthDays()}}

to get the number of days in a month, so you can use this number to create your repeat region for the table.

test.com/timesheet?month=May2024
Outputs 31

test.com/timesheet?month=November2024
Outputs 30

test.com/timesheet?month=February2025
Outputs 28
2 Likes