MCPcopy
hub / github.com/jonthornton/jquery-timepicker / roundingFunction

Function roundingFunction

jquery.timepicker.js:177–197  ·  view source on GitHub ↗
(seconds, settings)

Source from the content-addressed store, hash-verified

175 };
176
177 var roundingFunction = function roundingFunction(seconds, settings) {
178 if (seconds === null) {
179 return null;
180 }
181
182 var i = 0;
183 var nextVal = 0;
184
185 while (nextVal < seconds) {
186 i++;
187 nextVal += settings.step(i) * 60;
188 }
189
190 var prevVal = nextVal - settings.step(i - 1) * 60;
191
192 if (seconds - prevVal < nextVal - seconds) {
193 return moduloSeconds(prevVal, settings);
194 } else {
195 return moduloSeconds(nextVal, settings);
196 }
197 };
198
199 function moduloSeconds(seconds, settings) {
200 if (seconds == ONE_DAY && settings.show2400) {

Callers

nothing calls this directly

Calls 1

moduloSecondsFunction · 0.70

Tested by

no test coverage detected