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:
514 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var GetIntrinsic = require('get-intrinsic');
|
---|
4 |
|
---|
5 | var $TypeError = require('es-errors/type');
|
---|
6 | var $Date = GetIntrinsic('%Date%');
|
---|
7 | var $String = GetIntrinsic('%String%');
|
---|
8 |
|
---|
9 | var $isNaN = require('../helpers/isNaN');
|
---|
10 |
|
---|
11 | // https://262.ecma-international.org/6.0/#sec-todatestring
|
---|
12 |
|
---|
13 | module.exports = function ToDateString(tv) {
|
---|
14 | if (typeof tv !== 'number') {
|
---|
15 | throw new $TypeError('Assertion failed: `tv` must be a Number');
|
---|
16 | }
|
---|
17 | if ($isNaN(tv)) {
|
---|
18 | return 'Invalid Date';
|
---|
19 | }
|
---|
20 | return $String(new $Date(tv));
|
---|
21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.