File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ function msToDayHours(ms) {
5
5
return d . getHours ( ) + d . getMinutes ( ) / 60 ;
6
6
}
7
7
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 ) ;
9
11
}
10
12
function getDayStart ( ) {
11
13
return new Date ( ( new Date ( ) ) . toISOString ( ) . substr ( 0 , 10 ) ) . getTime ( ) ;
@@ -57,7 +59,7 @@ function showTides() {
57
59
}
58
60
59
61
function showMenu ( ) {
60
- let step = 5 / 60 ;
62
+ let step = 20 / 60 ;
61
63
E . showMenu ( {
62
64
"" :{ title :"Tides" , back : showTides } ,
63
65
"Low Tide" : {
@@ -68,7 +70,7 @@ function showMenu() {
68
70
let dayStart = getDayStart ( ) ;
69
71
let currHr = msToDayHours ( Date . now ( ) ) ;
70
72
if ( v + 1 < currHr ) v += 24 ;
71
- tide . offset = dayStart + ( v + tide . period / 2 ) * 3600000 ;
73
+ tide . offset = dayStart + v * 3600000 + tide . period / 2 ;
72
74
tide . save ( ) ;
73
75
showTides ( ) ;
74
76
}
You can’t perform that action at this time.
0 commit comments