String inputs should be validated and replaced by "today" values.
Summary: Ref T8060, String inputs should be validated and replaced by "today" values. Test Plan: Open Calendar advanced search, enter "tea time" in date input control, open datepicker, "today" should be selected. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8060 Differential Revision: https://secure.phabricator.com/D13018
This commit is contained in:
@@ -64,7 +64,9 @@ JX.behavior('fancy-datepicker', function() {
|
||||
JX.DOM.remove(picker);
|
||||
picker = null;
|
||||
JX.DOM.alterClass(root, 'picker-open', false);
|
||||
e.kill();
|
||||
if (e) {
|
||||
e.kill();
|
||||
}
|
||||
|
||||
root = null;
|
||||
};
|
||||
@@ -167,6 +169,11 @@ JX.behavior('fancy-datepicker', function() {
|
||||
if (isNaN(written_date.getTime())) {
|
||||
return new Date();
|
||||
} else {
|
||||
//year 01 should be 2001, not 1901
|
||||
if (written_date.getYear() < 70) {
|
||||
value_y += 2000;
|
||||
written_date = new Date(value_y, value_m-1, value_d);
|
||||
}
|
||||
return written_date;
|
||||
}
|
||||
}
|
||||
@@ -254,6 +261,11 @@ JX.behavior('fancy-datepicker', function() {
|
||||
return;
|
||||
}
|
||||
|
||||
var valid_date = getValidDate();
|
||||
value_y = valid_date.getYear() + 1900;
|
||||
value_m = valid_date.getMonth() + 1;
|
||||
value_d = valid_date.getDate();
|
||||
|
||||
var p = data.value.split(':');
|
||||
switch (p[0]) {
|
||||
case 'm':
|
||||
|
||||
Reference in New Issue
Block a user