-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix(types): Handle 12-hour time formats and narrow non-breaking spaces #26
Conversation
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.
Just a few minor comments, but seems good overall.
BTW, It irks me a little how inefficient the try-each-format parsing is, but while that could be improved, it's not necessary to over-engineer a solution for code that doesn't run very often. 🙂
I've added a On top of that, I also think we should support both For your review again! |
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.
I've added a lastUsedTimeFormat global variable that caches the last-known good time format that was used, to address this concern. I think this should be suitable for most use cases, since we likely can easily speed up time parsing of many timestamps in a single JSON blob by short-circuiting to the correct time format, and it's also highly unlikely that users would use different iOS region settings that sync to the same ingester server. 🙂
Yeah this is a decent improvement. 🙂
On top of that, I also think we should support both AM/PM and am/pm time formats. Go's time.Parse differentiates between the two 😮💨 But with the caching of the lastUsedTimeFormat I think the cost of adding new formats should be largely mitigated!
Works for me! This PR looks good now.
Fixes #25.