main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
731 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var $isNaN = require('../helpers/isNaN');
|
---|
6 | var padTimeComponent = require('../helpers/padTimeComponent');
|
---|
7 |
|
---|
8 | var HourFromTime = require('./HourFromTime');
|
---|
9 | var MinFromTime = require('./MinFromTime');
|
---|
10 | var SecFromTime = require('./SecFromTime');
|
---|
11 |
|
---|
12 | // https://262.ecma-international.org/9.0/#sec-timestring
|
---|
13 |
|
---|
14 | module.exports = function TimeString(tv) {
|
---|
15 | if (typeof tv !== 'number' || $isNaN(tv)) {
|
---|
16 | throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number');
|
---|
17 | }
|
---|
18 | var hour = HourFromTime(tv);
|
---|
19 | var minute = MinFromTime(tv);
|
---|
20 | var second = SecFromTime(tv);
|
---|
21 | return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT';
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.