Форматирование даты-времени вынес в функцию

parent 0ab32e07
...@@ -52,6 +52,18 @@ $(document).ready(function(){ ...@@ -52,6 +52,18 @@ $(document).ready(function(){
} }
} }
function getDateValue(dataDate)
{
return dataDate.split(' ')[0];
}
function getHourMinValue(dataDate)
{
var
timeVal = dataDate.split(' ')[1].split(':'),
timeValCorrected = timeVal[0]+':'+timeVal[1];
return timeValCorrected;
}
function RenderInterval(dataLineChartStat) function RenderInterval(dataLineChartStat)
{ {
var var
...@@ -126,14 +138,8 @@ $(document).ready(function(){ ...@@ -126,14 +138,8 @@ $(document).ready(function(){
currentActiveLine = 'Price'; currentActiveLine = 'Price';
$row.append($('<td class="'+ line +'">').append(templateBasketContent({data: dataBasket, formatPrice: valueFormat}))); $row.append($('<td class="'+ line +'">').append(templateBasketContent({data: dataBasket, formatPrice: valueFormat})));
} else if (line == 'Timestamp') { } else if (line == 'Timestamp') {
var
dateTimeValue = item[line].split(' '),
dateVal = dateTimeValue[0],
timeVal = dateTimeValue[1].split(':'),
timeValCorrected = timeVal[0]+':'+timeVal[1];
$row.append($('<td class="'+ line +'">').append(templateTimestampContent({ $row.append($('<td class="'+ line +'">').append(templateTimestampContent({
data: {date: dateVal, time: timeValCorrected} data: {date: getDateValue(item[line]), time: getHourMinValue(item[line])}
}))); })));
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment