Skip to content

Commit eac9ccc

Browse files
committed
minor tweaks/fixes
1 parent db6de49 commit eac9ccc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

apps/tidetimes/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ function msToDayHours(ms) {
55
return d.getHours()+d.getMinutes()/60;
66
}
77
function dayHoursToStr(t) {
8-
return Math.floor(t) + ":" + Math.round((t-Math.floor(t))*60).toString().padStart(2,0);
8+
t = Math.round(t*60)/60;
9+
var hrs = Math.floor(t);
10+
return hrs + ":" + Math.round((t-hrs)*60).toString().padStart(2,0);
911
}
1012
function getDayStart() {
1113
return new Date((new Date()).toISOString().substr(0,10)).getTime();
@@ -57,7 +59,7 @@ function showTides() {
5759
}
5860

5961
function showMenu() {
60-
let step = 5/60;
62+
let step = 20/60;
6163
E.showMenu({
6264
"":{title:"Tides", back : showTides },
6365
"Low Tide" : {
@@ -68,7 +70,7 @@ function showMenu() {
6870
let dayStart = getDayStart();
6971
let currHr = msToDayHours(Date.now());
7072
if (v+1<currHr) v+=24;
71-
tide.offset = dayStart + (v + tide.period/2)*3600000;
73+
tide.offset = dayStart + v*3600000 + tide.period/2;
7274
tide.save();
7375
showTides();
7476
}

0 commit comments

Comments
 (0)