|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
519 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('math-intrinsics/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.