mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-10 19:34:51 +01:00
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:
parent
7ab7c71319
commit
c2351208c0
1 changed files with 13 additions and 1 deletions
|
@ -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':
|
||||
|
|
Loading…
Add table
Reference in a new issue