mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-30 13:44:45 +01:00
24 lines
758 B
JavaScript
24 lines
758 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var $isFinite = require('../helpers/isFinite');
|
||
|
var timeConstants = require('../helpers/timeConstants');
|
||
|
var msPerSecond = timeConstants.msPerSecond;
|
||
|
var msPerMinute = timeConstants.msPerMinute;
|
||
|
var msPerHour = timeConstants.msPerHour;
|
||
|
|
||
|
var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
|
||
|
|
||
|
// https://262.ecma-international.org/12.0/#sec-maketime
|
||
|
|
||
|
module.exports = function MakeTime(hour, min, sec, ms) {
|
||
|
if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) {
|
||
|
return NaN;
|
||
|
}
|
||
|
var h = ToIntegerOrInfinity(hour);
|
||
|
var m = ToIntegerOrInfinity(min);
|
||
|
var s = ToIntegerOrInfinity(sec);
|
||
|
var milli = ToIntegerOrInfinity(ms);
|
||
|
var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
|
||
|
return t;
|
||
|
};
|