2020-08-25 23:57:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 03:58:33 +00:00
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
2020-08-25 23:57:08 +00:00
|
|
|
|
|
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
|
|
|
|
|
|
|
var $isNaN = require('../helpers/isNaN');
|
|
|
|
var padTimeComponent = require('../helpers/padTimeComponent');
|
|
|
|
|
|
|
|
var HourFromTime = require('./HourFromTime');
|
|
|
|
var MinFromTime = require('./MinFromTime');
|
|
|
|
var SecFromTime = require('./SecFromTime');
|
|
|
|
var Type = require('./Type');
|
|
|
|
|
2022-11-10 10:43:16 +00:00
|
|
|
// https://262.ecma-international.org/9.0/#sec-timestring
|
2020-08-25 23:57:08 +00:00
|
|
|
|
|
|
|
module.exports = function TimeString(tv) {
|
|
|
|
if (Type(tv) !== 'Number' || $isNaN(tv)) {
|
|
|
|
throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number');
|
|
|
|
}
|
|
|
|
var hour = HourFromTime(tv);
|
|
|
|
var minute = MinFromTime(tv);
|
|
|
|
var second = SecFromTime(tv);
|
|
|
|
return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT';
|
|
|
|
};
|