1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 07:50:57 +01:00

When scrolling forward a month in calendar date picker from 1/31, next chosen date should be 2/29, not 3/1.

Summary: Fixes T9295

Test Plan: Create event, open datepicker for start date, choose 1/31/2016, open datepicker again, click right button to scroll month. New suggested date should be 2/29/2016

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T9295

Differential Revision: https://secure.phabricator.com/D15727
This commit is contained in:
lkassianik 2016-04-15 13:52:00 -07:00
parent 7f15e8fbe8
commit eeccaf99b6
2 changed files with 18 additions and 9 deletions

View file

@ -479,7 +479,7 @@ return array(
'rsrc/js/core/behavior-device.js' => 'b5b36110',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '4f6a4b4e',
'rsrc/js/core/behavior-error-log.js' => '6882e80a',
'rsrc/js/core/behavior-fancy-datepicker.js' => '8ae55229',
'rsrc/js/core/behavior-fancy-datepicker.js' => '568931f3',
'rsrc/js/core/behavior-file-tree.js' => '88236f00',
'rsrc/js/core/behavior-form.js' => '5c54cbf3',
'rsrc/js/core/behavior-gesture.js' => '3ab51e2c',
@ -622,7 +622,7 @@ return array(
'javelin-behavior-editengine-reorder-fields' => 'b59e1e96',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-event-all-day' => '38dcf3c8',
'javelin-behavior-fancy-datepicker' => '8ae55229',
'javelin-behavior-fancy-datepicker' => '568931f3',
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
'javelin-behavior-high-security-warning' => 'a464fe03',
@ -1301,6 +1301,13 @@ return array(
'phabricator-drag-and-drop-file-upload',
'javelin-workboard-board',
),
'568931f3' => array(
'javelin-behavior',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'56a1ca03' => array(
'javelin-behavior',
'javelin-behavior-device',
@ -1554,13 +1561,6 @@ return array(
'javelin-install',
'javelin-dom',
),
'8ae55229' => array(
'javelin-behavior',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-vector',
),
'8bdb2835' => array(
'phui-fontkit-css',
),

View file

@ -264,6 +264,7 @@ JX.behavior('fancy-datepicker', function(config, statics) {
function getValidDate() {
var written_date = new Date(value_y, value_m-1, value_d);
if (isNaN(written_date.getTime())) {
return new Date();
} else {
@ -272,6 +273,14 @@ JX.behavior('fancy-datepicker', function(config, statics) {
value_y += 2000;
written_date = new Date(value_y, value_m-1, value_d);
}
// adjust for a date like February 31
var adjust = 1;
while (written_date.getMonth() !== value_m-1) {
written_date = new Date(value_y, value_m-1, value_d-adjust);
adjust++;
}
return written_date;
}
}