Calendar Picker Default to Show Previous Month

rslackrslack ✭✭✭✭
edited February 5, 2020 in Questions

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!


  • Josh CutlerJosh Cutler ✭✭✭
    edited August 19, 2014
    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!

  • rslackrslack ✭✭✭✭
    edited February 5, 2020

    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.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!