This is working actually fine. The only thing i'm fighting with is that with using this method every month has 31 days. Is there a existing plugin that can handle this or should I adjust this function? And if so where is the best place to look or find a tutorial about this subject!

What about s? You are caching the settings, but you're doing that outside the DateWidget object. It's not pretty. Also, settings are DateWidget property, do you think it needs additional caching like this? Or DW?

Unfortunately for Chris Coyier, that's not the module pattern. The module pattern involves a private scope created by an IIFE.

Anyway, caching a property like what you're trying to do with s is not useful. Consider what happens in the most likely to occur misuse scenario: if you fail to include its declaration. It will simply be added as a property to DateWidget, creating a reference for settings property in the same DateWidget object. Redundant.

The current case, where you include its declaration, it's simply a reference, it doesn't cache more than an object property would.

It's the right pattern, not using IIFE, because you don't need hidden state, and you need shared behavior. Just that s and DW are not really doing anything useful. I'll try and see if I can amend your widget.