Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9313438
date-to-iso-string.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
date-to-iso-string.js
View Options
'use strict'
;
var
global
=
require
(
'../internals/global'
);
var
uncurryThis
=
require
(
'../internals/function-uncurry-this'
);
var
fails
=
require
(
'../internals/fails'
);
var
padStart
=
require
(
'../internals/string-pad'
).
start
;
var
RangeError
=
global
.
RangeError
;
var
abs
=
Math
.
abs
;
var
DatePrototype
=
Date
.
prototype
;
var
n$DateToISOString
=
DatePrototype
.
toISOString
;
var
getTime
=
uncurryThis
(
DatePrototype
.
getTime
);
var
getUTCDate
=
uncurryThis
(
DatePrototype
.
getUTCDate
);
var
getUTCFullYear
=
uncurryThis
(
DatePrototype
.
getUTCFullYear
);
var
getUTCHours
=
uncurryThis
(
DatePrototype
.
getUTCHours
);
var
getUTCMilliseconds
=
uncurryThis
(
DatePrototype
.
getUTCMilliseconds
);
var
getUTCMinutes
=
uncurryThis
(
DatePrototype
.
getUTCMinutes
);
var
getUTCMonth
=
uncurryThis
(
DatePrototype
.
getUTCMonth
);
var
getUTCSeconds
=
uncurryThis
(
DatePrototype
.
getUTCSeconds
);
// `Date.prototype.toISOString` method implementation
// https://tc39.es/ecma262/#sec-date.prototype.toisostring
// PhantomJS / old WebKit fails here:
module
.
exports
=
(
fails
(
function
()
{
return
n$DateToISOString
.
call
(
new
Date
(
-
5e13
-
1
))
!=
'0385-07-25T07:06:39.999Z'
;
})
||
!
fails
(
function
()
{
n$DateToISOString
.
call
(
new
Date
(
NaN
));
}))
?
function
toISOString
()
{
if
(
!
isFinite
(
getTime
(
this
)))
throw
RangeError
(
'Invalid time value'
);
var
date
=
this
;
var
year
=
getUTCFullYear
(
date
);
var
milliseconds
=
getUTCMilliseconds
(
date
);
var
sign
=
year
<
0
?
'-'
:
year
>
9999
?
'+'
:
''
;
return
sign
+
padStart
(
abs
(
year
),
sign
?
6
:
4
,
0
)
+
'-'
+
padStart
(
getUTCMonth
(
date
)
+
1
,
2
,
0
)
+
'-'
+
padStart
(
getUTCDate
(
date
),
2
,
0
)
+
'T'
+
padStart
(
getUTCHours
(
date
),
2
,
0
)
+
':'
+
padStart
(
getUTCMinutes
(
date
),
2
,
0
)
+
':'
+
padStart
(
getUTCSeconds
(
date
),
2
,
0
)
+
'.'
+
padStart
(
milliseconds
,
3
,
0
)
+
'Z'
;
}
:
n$DateToISOString
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 11:39 AM (5 d, 1 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3368595
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment