-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Added zero-padding to timestamp output #40095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The code looks fine to me, but @sheetalkamat @amcasey or @uniqueiniquity will know what the ramifications of changing the format are. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the concept, but please extract a function. Consider mimicking/unifying with padLeft.
…gs other than a single space as padding. Used this new functionality to zero-pad the timestamp created by nowString().
Thank you for your feedback. I didn't realize those functions existed already and I'm a fan of unifying similar capabilities where it makes sense. With this update, we can pad using any string, similar to padStart() and padEnd() in JS. Even though the original bug didn't need it, I also updated I'd like to test this further but wanted your feedback on this change before I spend too much time doing that... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! One more suggestion, but looks good.
…ted padRight() to mirror padLeft() but without the option to use zeros since that would be an unlikely use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for the changes.
@rhillefeld Happy to merge if you're done. |
@amcasey yes, that should do it. Thanks! |
Fixes #31272
Fixed the output of
nowString()
to properly zero-pad individual timestamp components (hours, minutes, seconds, milliseconds). This affects the log output of tsserver.