source: imaps-frontend/node_modules/es-abstract/5/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: 698 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 ToInteger = require('./ToInteger');
10
11// https://262.ecma-international.org/5.1/#sec-15.9.1.11
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 = ToInteger(hour);
18 var m = ToInteger(min);
19 var s = ToInteger(sec);
20 var milli = ToInteger(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.