* finish 2020

This commit is contained in:
chujilu
2014-08-15 15:59:35 +08:00
parent 56737be238
commit 2e344f2e0d
4 changed files with 55 additions and 2 deletions

View File

@@ -29,3 +29,22 @@ function computeEndDate(delta)
endDate = endDate.toString('yyyy-M-dd');
$('#end').val(endDate);
}
/**
* when begin date input change and end date input is null
* change end date input to begin's after day
*
* @access public
* @return void
*/
function suitEndDate()
{
beginDate = $('#begin').val();
if(!beginDate) return;
endDate = $('#end').val();
if(endDate) return;
endDate = convertStringToDate(beginDate).addDays(1);
endDate = endDate.toString('yyyy-M-dd');
$('#end').val(endDate);
}

View File

@@ -33,7 +33,7 @@
</tr>
<tr>
<th><?php echo $lang->productplan->begin;?></th>
<td><?php echo html::input('begin', $begin, "class='form-control form-date'");?></td>
<td><?php echo html::input('begin', $begin, "class='form-control form-date' onchange='suitEndDate()'");?></td>
</tr>
<tr>
<th><?php echo $lang->productplan->end;?></th>

View File

@@ -25,3 +25,36 @@ function loadProjectBuilds(projectID)
$('#buildBox').load(link);
}
/**
* Convert a date string like 2011-11-11 to date object in js.
*
* @param string $date
* @access public
* @return date
*/
function convertStringToDate(dateString)
{
dateString = dateString.split('-');
dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0];
return Date.parse(dateString);
}
/**
* when begin date input change and end date input is null
* change end date input to begin's after day
*
* @access public
* @return void
*/
function suitEndDate()
{
beginDate = $('#begin').val();
if(!beginDate) return;
endDate = $('#end').val();
if(endDate) return;
endDate = convertStringToDate(beginDate).addDays(1);
endDate = endDate.toString('yyyy-M-dd');
$('#end').val(endDate);
}

View File

@@ -13,6 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<div class='container'>
<div id='titlebar'>
<div class='heading'>
@@ -51,7 +52,7 @@
</tr>
<tr>
<th><?php echo $lang->testtask->begin;?></th>
<td><?php echo html::input('begin', '', "class='form-control form-date'");?></td>
<td><?php echo html::input('begin', '', "class='form-control form-date' onchange='suitEndDate()'");?></td>
</tr>
<tr>
<th><?php echo $lang->testtask->end;?></th>