Skip to content

Conversation

@andrewvasilchuk
Copy link
Contributor

Use String#slice instead of String#replace since it is ~20% faster in this particular case according to this performance test.

Use `String#slice` instead of `String#replace` since it is ~15% faster in this particular case
@iheanyi
Copy link
Contributor

iheanyi commented Aug 14, 2023

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 iheanyi closed this Aug 14, 2023
@andrewvasilchuk
Copy link
Contributor Author

@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.

@iheanyi
Copy link
Contributor

iheanyi commented Aug 14, 2023

Good point, that's a good call then. I'll reopen this then

@iheanyi iheanyi reopened this Aug 14, 2023
@ayrton ayrton enabled auto-merge December 14, 2023 13:03
@ayrton
Copy link
Contributor

ayrton commented Dec 14, 2023

Thank you

@ayrton ayrton merged commit 1c02bdf into planetscale:main Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants