Исправлена ошибка с датой подключения устройств

This commit is contained in:
Denis Smirnov 2013-10-24 13:12:07 +04:00
parent d1114df4a2
commit 5e1554f1d9
5 changed files with 25 additions and 4 deletions

View File

@ -10,6 +10,10 @@ Template.devices_list.get_name_by_id = function () {
if (!owner) return "Не известно";
return owner.name + " " + owner.surname;
};
Template.devices_list.get_checkin_date = function () {
return GetTimeAndDateFromDate(this.checkin_date);
};
// ----------
// ----------

View File

@ -28,7 +28,7 @@
<b>{{get_name_by_id}}</b>
</div>
<div>
{{checkin_date}}
{{get_checkin_date}}
</div>
</td>
</tr>

View File

@ -0,0 +1,18 @@
GetTimeAndDateFromDate = function(date) {
if (!date) return "";
var hours = date.getHours();
if (hours < 10) hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10) minutes = "0" + minutes;
var days = date.getDate();
if (days < 10) days = "0" + days;
var months = date.getMonth() + 1;
if (months < 10) months = "0" + months;
return hours + ":" + minutes + " " + days + "." + months + "." + date.getFullYear();
};

View File

@ -17,8 +17,7 @@ Meteor.startup(function () {
console.log("-------- Устройство: ", device.name);
var checkinDate = GetCurrentDateAndTime ();
Devices.update(device._id, {$set: {checkin_date: checkinDate, owner_id: user._id}});
Devices.update(device._id, {$set: {checkin_date: new Date(), owner_id: user._id}});
});
});

View File

@ -9,7 +9,7 @@ Meteor.startup(function () {
return "Can't find such MAC-addreses";
var date = new Date();
Log_User_Login.insert({name: user.name, surname: user.sername, login_date: date});
Log_User_Login.insert({name: user.name, surname: user.surname, login_date: date});
});
});