From 38340e01ff8bec3c1a89b9bd294c49f78a73e411 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 22 Jun 2019 22:07:29 +0000
Subject: [PATCH] Fix delay calcs when times are from two different days (i.e. 23:59-00:00)

---
 common.js  |    5 ++---
 index.html |    2 +-
 map.html   |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/common.js b/common.js
index c1fceeb..964cf68 100644
--- a/common.js
+++ b/common.js
@@ -165,10 +165,9 @@
 }
 
 function parseTime(date, time) {
-	var result = new Date(date.getFullYear(), date.getMonth(), date.getDay());
+	var result = new Date(date.getTime());
 	var time_split = time.split(':');
-	result.setHours(time_split[0]);
-	result.setMinutes(time_split[1]);
+	result.setHours(time_split[0], time_split[1], 0);
 	
 	if(result.getTime() - date.getTime() > 72000000) {
 		result.setTime(result.getTime() - 86400000);
diff --git a/index.html b/index.html
index e65bc24..eb69a99 100644
--- a/index.html
+++ b/index.html
@@ -135,7 +135,7 @@
 		</div>
 		<script src="https://polyfill.io/v3/polyfill.min.js?features=Promise,XMLHttpRequest"></script>
 		<script type="text/javascript" src="lang_pl.js?v9" id="lang_script"></script>
-		<script type="text/javascript" src="common.js?v9"></script>
+		<script type="text/javascript" src="common.js?v10"></script>
 		<script type="text/javascript" src="index.js?v8"></script>
 	</body>
 </html>
diff --git a/map.html b/map.html
index afc9df8..979e4a8 100644
--- a/map.html
+++ b/map.html
@@ -24,7 +24,7 @@
 <script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach,Array.prototype.includes,Array.prototype.map,Element.prototype.classList,Promise,String.prototype.startsWith,XMLHttpRequest,requestAnimationFrame"></script>
 <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script>
 <script tyle="text/javascript" src="lang_pl.js?v9" id="lang_script"></script>
-<script tyle="text/javascript" src="common.js?v9"></script>
+<script tyle="text/javascript" src="common.js?v10"></script>
 <script tyle="text/javascript" src="map.js?v22"></script>
 </body>
 </html>

--
Gitblit v1.9.1