-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: accept entry.timestamp string input in RFC3339 format #937
Conversation
Codecov Report
@@ Coverage Diff @@
## master #937 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 18 18
Lines 10928 10940 +12
Branches 367 372 +5
=======================================
+ Hits 10733 10745 +12
Misses 193 193
Partials 2 2
Continue to review full report at Codecov.
|
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.
Nit on usage of parseInt
, but otherwise LGTM
src/entry.ts
Outdated
const nanoSecs = zuluTime.match(reNano)?.[1]; | ||
entry.timestamp = { | ||
seconds: ms ? Math.floor(ms / 1000) : 0, | ||
nanos: nanoSecs ? parseInt(nanoSecs.padEnd(9, '0')) : 0, |
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.
It's generally safer to use the Number
constructor instead of parseInt
. parseInt
is more liberal in what it accepts, and in some cases can make assumptions about the radix (leading 0s and octal numbers, etc).
Fixes #934
Context: