1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Fix start in fancy datepicker calendar

Summary:
Fixes T9675.
Fixes the calculation for the difference between the first day of the month and the first day of the week. It was previously possible for this to be negative, which caused the subsequent loop to hang the browser.

Test Plan:
- Set week to start on Sunday. Observed that the calendar still renders fine.
- Set week to start on Monday. Observed that the browser no longer hangs on November 2015.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9675

Differential Revision: https://secure.phabricator.com/D14409
This commit is contained in:
Dmitri Iouchtchenko 2015-11-05 07:07:37 -08:00 committed by epriestley
parent 6a035d977f
commit 9366edf255
2 changed files with 11 additions and 11 deletions

View file

@ -453,7 +453,7 @@ return array(
'rsrc/js/core/behavior-device.js' => 'a205cf28', 'rsrc/js/core/behavior-device.js' => 'a205cf28',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e', 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e',
'rsrc/js/core/behavior-error-log.js' => '6882e80a', 'rsrc/js/core/behavior-error-log.js' => '6882e80a',
'rsrc/js/core/behavior-fancy-datepicker.js' => '665cf6ac', 'rsrc/js/core/behavior-fancy-datepicker.js' => '8ae55229',
'rsrc/js/core/behavior-file-tree.js' => '88236f00', 'rsrc/js/core/behavior-file-tree.js' => '88236f00',
'rsrc/js/core/behavior-form.js' => '5c54cbf3', 'rsrc/js/core/behavior-form.js' => '5c54cbf3',
'rsrc/js/core/behavior-gesture.js' => '3ab51e2c', 'rsrc/js/core/behavior-gesture.js' => '3ab51e2c',
@ -586,7 +586,7 @@ return array(
'javelin-behavior-durable-column' => 'c72aa091', 'javelin-behavior-durable-column' => 'c72aa091',
'javelin-behavior-error-log' => '6882e80a', 'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-event-all-day' => '38dcf3c8', 'javelin-behavior-event-all-day' => '38dcf3c8',
'javelin-behavior-fancy-datepicker' => '665cf6ac', 'javelin-behavior-fancy-datepicker' => '8ae55229',
'javelin-behavior-global-drag-and-drop' => 'c8e57404', 'javelin-behavior-global-drag-and-drop' => 'c8e57404',
'javelin-behavior-herald-rule-editor' => '7ebaeed3', 'javelin-behavior-herald-rule-editor' => '7ebaeed3',
'javelin-behavior-high-security-warning' => 'a464fe03', 'javelin-behavior-high-security-warning' => 'a464fe03',
@ -1294,13 +1294,6 @@ return array(
'javelin-vector', 'javelin-vector',
'differential-inline-comment-editor', 'differential-inline-comment-editor',
), ),
'665cf6ac' => array(
'javelin-behavior',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'6882e80a' => array( '6882e80a' => array(
'javelin-dom', 'javelin-dom',
), ),
@ -1500,6 +1493,13 @@ return array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
), ),
'8ae55229' => array(
'javelin-behavior',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'8b3fd187' => array( '8b3fd187' => array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',

View file

@ -300,10 +300,10 @@ JX.behavior('fancy-datepicker', function(config, statics) {
// Render the calendar itself. NOTE: Javascript uses 0-based month indexes // Render the calendar itself. NOTE: Javascript uses 0-based month indexes
// while we use 1-based month indexes, so we have to adjust for that. // while we use 1-based month indexes, so we have to adjust for that.
var days = []; var days = [];
var start = new Date( var start = (new Date(
valid_date.getYear() + 1900, valid_date.getYear() + 1900,
valid_date.getMonth(), valid_date.getMonth(),
1).getDay() - week_start; 1).getDay() - week_start + 7) % 7;
while (start--) { while (start--) {
days.push(cell('', null, false, 'day-placeholder')); days.push(cell('', null, false, 'day-placeholder'));