mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-27 12:14:45 +01:00
25 lines
808 B
JavaScript
25 lines
808 B
JavaScript
'use strict';
|
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
|
|
|
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');
|
|
|
|
// https://262.ecma-international.org/9.0/#sec-timestring
|
|
|
|
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';
|
|
};
|