Browse Source

Merge 113731ab07 into 055f7b0580

pull/3355/merge
Louise Farrow 2 years ago
committed by GitHub
parent
commit
c968358241
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions
  1. +26
    -0
      Date calculation

+ 26
- 0
Date calculation View File

@@ -0,0 +1,26 @@
//1- lowest to now
//2 -highest to now
function remaning_time(Выбранная_дата, Тип_отсчета){
var tDate = new Date;
var sec = 1000;
var min = 60*sec;
var hour = 60*min;
var day = 24*hour;
// 1 - means lowest date to current date
if(Тип_отсчета == 1){
var diff = tDate-Выбранная_дата;
var days = Math.floor(diff/day);
var hours = Math.floor(diff%day/hour);
var minutes = Math.floor(diff%day%hour/min);
return ['> ' + days + 'dd. ' + hours + 'hh. ' + minutes + 'mm.'];
}
// 2 - means highest date to current date
if(Тип_отсчета == 2){
var diff=Выбранная_дата-tDate;
var days = Math.floor(diff/day);
var hours = Math.floor(diff%day/hour);
var minutes = Math.floor(diff%day%hour/min);
return [days + 'д. ' + hours + 'ч. ' + minutes + 'м.'+ ' >'];
}

}

Loading…
Cancel
Save