source: imaps-frontend/node_modules/es-abstract/2018/TimeString.js

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
RevLine 
[d565449]1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var $isNaN = require('../helpers/isNaN');
6var padTimeComponent = require('../helpers/padTimeComponent');
7
8var HourFromTime = require('./HourFromTime');
9var MinFromTime = require('./MinFromTime');
10var SecFromTime = require('./SecFromTime');
11
12// https://262.ecma-international.org/9.0/#sec-timestring
13
14module.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.