Calendar Picker Default to Show Previous Month

We do our billing for the previous month a week or two after the end of the month.  SO for instance it is August right now.  When my end users click on the date field it defaults to August so they always have to click the back arrow on the calendar once for each record.  Is there a way to default the calendar selector to always show the previous month?


Thank you!

For a little background on the jQuery UI Datepicker, which is used by Skuid, see Zach’s community post at this link.

In this case, an Inline Javascript snippet will do the trick.

Go to the Page Builder for the page that requires the previous month as a default. Click on the Resources tab in the Page Builder.

Click on Javascript and then click the button to add a snippet.

Choose In-Line for the Resource Location.

Enter a name for your snippet. In this example, I used PreviousMonth.

In the Resource Body, place the following code:

skuid.$.datepicker.setDefaults({ defaultDate: '-1m' });

Close the code box and click Save!

This snippet will default all of the datepickers for this page  to the previous month. If you want this on other pages, then you can add the snippet to those pages, as well.

Good luck!

-Josh

Thank you Josh, that worked awesome and easy implementation.  For those attempting this don't get In-Line and In-Line (Snippet) mixed up.  This fix requires Inline just like Josh said.  Small detail that is easy to overlook if not careful.