Cast firstDay input to number for moment >=2.11
Starting with moment.js 2.11.0, the first day of the week (`dow`) needs to be supplied as a number type (e.g. `0` for Sunday). Supplying a string (e.g. `"0"` for Sunday) will result in incorrect week number calculation. This Calendar app sets FullCalendar's `firstDay` option, which in turn sets moment.js' `dow`. Both moment.js and FullCalendar have indicated that they will not be accepting or sanitizing strings (see moment/moment issue 2900 and fullcalendar/fullcalendar issue 3014). Note that FullCalendar is supplied by this Calendar app, but that moment.js is supplied by core. Both ownCloud core and Nextcloud core currently still depend on moment 2.10. Also note that week number functionality for this Calendar app is still under development (see owncloud/calendar issue 262 and fullcalendar/fullcalendar issue 3024). However, when using the week number functionality in combination with a manual upgrade of core's moment to version 2.13.0, week numbers were indeed calculated incorrectly (see screenshots in the pull request for this commit). This commit contains a preventive fix that adds unary plusses to the input for FullCalendar's `firstDay` option, so that any string is cast to number. It can be applied now already and will prevent problems when core upgrades its moment.js dependency to a higher version.
Loading
Please register or sign in to comment