source: imaps-frontend/node_modules/es-abstract/2021/MakeTime.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 758 bytes
Line 
1'use strict';
2
3var $isFinite = require('../helpers/isFinite');
4var timeConstants = require('../helpers/timeConstants');
5var msPerSecond = timeConstants.msPerSecond;
6var msPerMinute = timeConstants.msPerMinute;
7var msPerHour = timeConstants.msPerHour;
8
9var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
10
11// https://262.ecma-international.org/12.0/#sec-maketime
12
13module.exports = function MakeTime(hour, min, sec, ms) {
14 if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) {
15 return NaN;
16 }
17 var h = ToIntegerOrInfinity(hour);
18 var m = ToIntegerOrInfinity(min);
19 var s = ToIntegerOrInfinity(sec);
20 var milli = ToIntegerOrInfinity(ms);
21 var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
22 return t;
23};
Note: See TracBrowser for help on using the repository browser.