Closed andrewvasilchuk closed 11 months ago
Going to close this one out. We only want to use replace
in the sense that if the Z
exists at the end, remove it. With this change, we're losing precision if the string doesn't contain the timezone.
@iheanyi thanks for the feedback. Following MDN Date.prototype.toISOString() and ECMAScript Language Specification, a date string, returned from the Date#toISOString
method always contain a "Z" char at the end.
Good point, that's a good call then. I'll reopen this then
Thank you
Use
String#slice
instead ofString#replace
since it is ~20% faster in this particular case according to this performance test.