@@ -138,7 +138,7 @@ function calculate() {
138
138
calculateSimpleDive ( dictionary . Sd , inputDepth2 . value , inputDuration2 . value )
139
139
return
140
140
}
141
- addVariable ( `${ dictionary . Rif } ${ inputInterval . value } ${ dictionary . minutes } ` , refInterval , ` ${ dictionary . min } ` )
141
+ addVariable ( `${ dictionary . Rif } ${ minToHour ( inputInterval . value ) } ` , minToHour ( refInterval ) )
142
142
143
143
const nitCoef = Mn90Cr [ firstDiveStop [ 5 ] ] [ refIntervalPos ]
144
144
const refCoefPos = posNext ( nitCoef , TbCoeff )
@@ -151,13 +151,13 @@ function calculate() {
151
151
addVariable ( `${ dictionary . Rdf } ${ inputDepth2 . value } ${ dictionary . meters } ` , refDepth2 , `${ dictionary . m } ` )
152
152
153
153
const increase = Majo [ refDepth2 ] [ refCoefPos ]
154
- addVariable ( `${ dictionary . Sdi } ` , increase , ` ${ dictionary . min } ` )
154
+ addVariable ( `${ dictionary . Sdi } ` , minToHour ( increase ) )
155
155
156
156
const increasedDuration = Number ( inputDuration2 . value ) + increase
157
157
const refDuration2 = next ( increasedDuration , Mn90T [ refDepth2 ] )
158
158
if ( ! refDuration2 )
159
159
throw new Error ( `<div>${ dictionary . Tdtdneitt . replace ( ':1:' , increasedDuration ) . replace ( ':2:' , refDepth2 ) } </div>` )
160
- addVariable ( `${ dictionary . Rduf } ${ increasedDuration } ${ dictionary . minutes } ` , refDuration2 , ` ${ dictionary . min } ` )
160
+ addVariable ( `${ dictionary . Rduf } ${ minToHour ( increasedDuration ) } ` , minToHour ( refDuration2 ) )
161
161
let secondDiveStop = Mn90P [ refDepth2 + "" + refDuration2 ]
162
162
163
163
results . innerHTML += `<div><h3>${ dictionary . Sd } </h3>
@@ -177,7 +177,7 @@ function calculateSimpleDive(label, inputDepth, inputDuration) {
177
177
const refDuration = next ( inputDuration , Mn90T [ refDepth ] )
178
178
if ( ! refDuration )
179
179
throw new Error ( `<div>${ dictionary . Tdtdneitt . replace ( ':1:' , inputDuration ) . replace ( ':2:' , refDepth ) } </div>` )
180
- addVariable ( `${ dictionary . Rduf } ${ inputDuration } ${ dictionary . minutes } ` , refDuration , ` ${ dictionary . min } ` )
180
+ addVariable ( `${ dictionary . Rduf } ${ minToHour ( inputDuration ) } ` , minToHour ( refDuration ) )
181
181
182
182
const diveStop = Mn90P [ refDepth + "" + refDuration ]
183
183
addVariable ( `${ dictionary . GPSfxmitxmt . replace ( ':1:' , refDuration ) . replace ( ':2:' , refDepth ) } ` , diveStop [ 5 ] )
@@ -261,3 +261,14 @@ function handleShare(e) {
261
261
} , 1500 )
262
262
} )
263
263
}
264
+
265
+ function minToHour ( value ) {
266
+ const hours = Math . floor ( value / 60 )
267
+ const minutes = value % 60
268
+ if ( hours === 0 )
269
+ return `${ value } ${ dictionary . min } `
270
+ if ( minutes === 0 )
271
+ return `${ hours } h`
272
+
273
+ return `${ Math . floor ( value / 60 ) } h${ value % 60 } `
274
+ }
0 commit comments