Skip to content

Commit

Permalink
fix with IsoDates(mongodb) in script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel committed Jul 13, 2011
1 parent 748d216 commit d04afcf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions public/js/script.js
Expand Up @@ -85,7 +85,7 @@ socket.on('initUsers', function(users) {
socket.on('deskCreationDate', function(date) {
console.log('<--- deskCreationDate', date);
if(!timerForDeskTimeOut) {
setTimer(date);
setTimer(date, true);
timerForDeskTimeOut = true;
}
});
Expand Down Expand Up @@ -743,15 +743,18 @@ function showProcess(tempFileId, bytesReceived, bytesExpected) {
/* Creats Timer for DeskTimeOut
* @params creationTime of desk as date object
* */
function setTimer(date) {
function setTimer(date, isISODate) {

var s = date;
var a = s.split(/[^0-9]/);
//for (i=0;i<a.length;i++) { alert(a[i]); }
var d=new Date (a[0],a[1]-1,a[2],a[3],a[4],a[5] );
if(isISODate) {
var s = date;
var a = s.split(/[^0-9]/);
var d=new Date (a[0],a[1]-1,a[2],a[3],a[4],a[5] );
} else {
var d = date;
}

var deskTime = $('.timer').attr('id')/1000;
console.log(d);



deskTimeOut();
Expand All @@ -760,7 +763,6 @@ function setTimer(date) {
var currentTime = new Date();
var diffTime = currentTime.getTime()-d.getTime();
var timePast = diffTime/1000;
console.log(currentTime.getTime(), d, currentTime.getTime()-d.getTime());
var timeLeft = secondsToTime(deskTime-timePast);
var outputTextHour = '';
var outputTextMinute = '';
Expand Down

0 comments on commit d04afcf

Please sign in to comment.