eternicode/bootstrap-datepicker — pull request #49 by todofixthis (2012-04-21 21:07:53+00:00)
Title: Prevent bizarre behavior when `weekStart` is a string or other unusual value.

To integrate this plugin with a PHP application, we are sending the `weekStart` value to the frontend as a string, e.g.:

'weekStart': 'getWeekStart('w')); ?>'

Because Javascript treats the `+` operator as a concatenation operator when the LHS is a string, it causes weird behavior when the datepicker computes its `weekEnd` setting.

This pull request changes the datepicker to implicitly converts the incoming `weekStart` value to an int and mods it by the number of days in the week (according to the selected locale) to prevent weird values from messing up the display of the datepicker.