templates/stop.html

changeset 136
27324a81beca
parent 134
4ac0f2e2ec4e
equal deleted inserted replaced
135:ca21302d1a74 136:27324a81beca
17 display: none; 17 display: none;
18 } 18 }
19 19
20 .sarake-aika 20 .sarake-aika
21 { 21 {
22 width: 150pt; 22 width: 175pt;
23 } 23 }
24 24
25 .gone 25 .gone
26 { 26 {
27 background-color: #666; 27 background-color: #666;
50 xhr.send(); 50 xhr.send();
51 }; 51 };
52 52
53 function timeConverter(UNIX_timestamp) 53 function timeConverter(UNIX_timestamp)
54 { 54 {
55 const d = new Date();
56 const now = (d.getTime() + d.getTimezoneOffset()) / 1000;
55 var a = new Date(UNIX_timestamp * 1000); 57 var a = new Date(UNIX_timestamp * 1000);
56 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 58 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
59 var weekdays = ['Su', 'Mo', 'Tu', 'Wed', 'Th', 'Fr', 'Sa'];
57 var year = a.getFullYear(); 60 var year = a.getFullYear();
58 var month = months[a.getMonth()]; 61 var month = months[a.getMonth()];
59 var date = a.getDate(); 62 var date = a.getDate();
60 var hour = a.getHours(); 63 var hour = a.getHours();
61 var min = a.getMinutes(); 64 var min = a.getMinutes();
62 var sec = a.getSeconds(); 65 var sec = a.getSeconds();
63 var time = hour + ':' + (min < 10 ? '0' : '') + min; 66 var time = '';
67
68 if (date != d.getDate())
69 {
70 if (UNIX_timestamp - 7 * 24 * 60 * 60 < now)
71 time = weekdays[a.getDay()] + ' ';
72 else
73 time = '' + date + '.' + (a.getMonth() + 1) + '. ';
74 }
75 time += hour + ':' + (min < 10 ? '0' : '') + min;
64 return time; 76 return time;
65 } 77 }
66 78
67 function epoch() 79 function epoch()
68 { 80 {

mercurial