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 |
|
---|
3 | var $isFinite = require('../helpers/isFinite');
|
---|
4 | var timeConstants = require('../helpers/timeConstants');
|
---|
5 | var msPerSecond = timeConstants.msPerSecond;
|
---|
6 | var msPerMinute = timeConstants.msPerMinute;
|
---|
7 | var msPerHour = timeConstants.msPerHour;
|
---|
8 |
|
---|
9 | var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
|
---|
10 |
|
---|
11 | // https://262.ecma-international.org/12.0/#sec-maketime
|
---|
12 |
|
---|
13 | module.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.